.. index:: pair: class; funcmin::RgminOpt .. _doxid-classfuncmin_1_1_rgmin_opt: class funcmin::RgminOpt ======================= .. toctree:: :hidden: Overview ~~~~~~~~ Gradient-only rgmin session on the MAP objective. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class RgminOpt { public: // fields bool :target:`failedOptim` = false; bool :target:`exhaustedIterationBudget` = false; int :target:`completedIterations` = 0; // methods void :target:`setAlgorithmSettings`(const :ref:`gpr::ScgOptimizationSettings`& s); void :target:`setMethod`(rgmin::Method m); void :target:`setMethod`(rgmin_method_t m); rgmin::Method :target:`getMethod`() const; void :ref:`setMemory`(std::size_t m); std::size_t :target:`lbfgsPairCap`() const; std::size_t :ref:`appliedLbfgsMemoryForTesting`() const; void :target:`setMaxMove`(double m); void :target:`setGradTol`(double g); void :ref:`setBox`(Eigen::VectorXd lower, Eigen::VectorXd upper); void :ref:`setPersistentSession`(bool keep); void :ref:`setInitialLogMove`(double distance); void :ref:`setInitialLogMoveWholeSession`(bool whole_session); void :ref:`forgetSession`(); std::size_t :ref:`warmStarts`() const; std::size_t :ref:`warmPairs`() const; std::size_t :ref:`logicalObjectiveWork`() const; std::size_t :ref:`physicalObjectiveWork`() const; template void :target:`optimize`(const :ref:`gpr::EigenMatrix`& x, const Eigen::VectorXd& x_ind, const Eigen::VectorXd& y, Eigen::VectorXd& w, FuncName func_to_min, ClassName& holder, double current_barrier_strength, const Eigen::VectorXd& lengthscale_rho0 = Eigen::VectorXd(), const :ref:`MapObjectiveConfig`* objective_config = nullptr); template void :target:`optimizeWithObjectiveValues`(const :ref:`gpr::EigenMatrix`& x, const Eigen::VectorXd& x_ind, const Eigen::VectorXd& y, Eigen::VectorXd& w, FuncName func_to_min, ClassName& holder, double barrier_strength, const Eigen::VectorXd& lengthscale_rho0, const :ref:`MapObjectiveConfig`* objective_config, double* opening_value_out, double* last_value_out); static bool :ref:`methodFromName`(const char* name, rgmin_method_t& out); }; .. _details-classfuncmin_1_1_rgmin_opt: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Gradient-only rgmin session on the MAP objective. The solver axis is rgmin::optimize::Method. MAP_LBFGS selects L-BFGS. The C ABI is the hourglass; this class drives the RAII wrap. :ref:`RgminScg ` stays separate: rgmin_minimize_scg takes SCG parameters and a curvature callback the generic entry does not carry. Newton and RFO need an analytic Hessian of the marginal likelihood, which this objective does not supply. Methods ------- .. index:: pair: function; setMemory .. _doxid-classfuncmin_1_1_rgmin_opt_1a26fd24bb5e793e17d0fcdf4a2c1a5da5: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setMemory(std::size_t m) L-BFGS pairs kept by the solver and by the warm-start record. Zero selects the cap rgmin publishes as the default of OptimizeControl::memory, which is also the cap the C ABI uses when a control's memory is 0. .. index:: pair: function; appliedLbfgsMemoryForTesting .. _doxid-classfuncmin_1_1_rgmin_opt_1a7de6281c2d53252920a184fdb036932d: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t appliedLbfgsMemoryForTesting() const Pair cap installed on the session of the last fit. Zero before that fit. .. index:: pair: function; setBox .. _doxid-classfuncmin_1_1_rgmin_opt_1ae161c544691ba5065d5fb3cbe16da13c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setBox(Eigen::VectorXd lower, Eigen::VectorXd upper) Coordinate box on x + p. Empty is unbounded on that side. .. index:: pair: function; setPersistentSession .. _doxid-classfuncmin_1_1_rgmin_opt_1a2e939689660456076b0f60ce3df529ae: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setPersistentSession(bool keep) Transplant the previous fit's record into the next fit (off by default: every fit then opens a fresh session at the previous optimum with the cold opening step). A sequence of marginal likelihood fits, one per acquisition, minimises objectives that differ by the rows added since the last: the accepted steps of the previous fit, as curvature pairs, still describe the curvature at its optimum. Every fit opens a fresh session (its opening step is scaled to the new gradient); a warm start transplants the pairs into it when the record describes this objective (see warmPairs), and a caller that has found measured rows contradicting the posterior drops the record first (forgetSession). A changed dimension, method, tolerance, step cap or active subspace starts cold, and so does the fit after one that did not converge. .. index:: pair: function; setInitialLogMove .. _doxid-classfuncmin_1_1_rgmin_opt_1a7af20aed986f93516b49c29ca3459cab: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setInitialLogMove(double distance) Largest distance the first step of a cold session may move the parameters. Hyperparameters live in log coordinates, so one unit is a factor e in a length scale or an amplitude, and the objective is only meaningful near the start. The opening step of the session is not the unit step along the negative gradient when the gradient is large: the first step is capped through the solver's Euclidean move cap, which the line searches and trust radii honour, and the caller's cap is restored after it. Zero leaves the first step to the solver. .. index:: pair: function; setInitialLogMoveWholeSession .. _doxid-classfuncmin_1_1_rgmin_opt_1a44ee6e74d0cc2083f24106930f805ec6: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setInitialLogMoveWholeSession(bool whole_session) How the bound is applied. True (default): the opening step of the session control is lowered so the first trial of a cold session moves at most the bound, set from the gradient norm at the cold start, and it stays lowered for the life of the session, so every line search of the session opens there. False: only the first step of a cold session is capped, through the solver's move cap. .. index:: pair: function; forgetSession .. _doxid-classfuncmin_1_1_rgmin_opt_1ab0cd9fbd3c64af307e532a5af8f510c6: .. ref-code-block:: cpp :class: doxyrest-title-code-block void forgetSession() Drop the retained memory: the next fit starts cold. .. index:: pair: function; warmStarts .. _doxid-classfuncmin_1_1_rgmin_opt_1a1016edc49dbe04d33fb515813c42cd28: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t warmStarts() const Fits that opened after a converged fit of a compatible session (the previous optimum as start; the record consulted when transplanting). .. index:: pair: function; warmPairs .. _doxid-classfuncmin_1_1_rgmin_opt_1ad12f6279544d05224140964ab93f7978: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t warmPairs() const Curvature pairs the last fit took from the previous fit's record: zero when the record was dropped as another objective's (the move it proposes for the new gradient exceeds the opening trust, or the decrease it claims exceeds one nat per parameter). .. index:: pair: function; logicalObjectiveWork .. _doxid-classfuncmin_1_1_rgmin_opt_1a64570d7dd168544e907b555730e5d2c9: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t logicalObjectiveWork() const Objective-count units for the fit under a single-entry request cache. .. index:: pair: function; physicalObjectiveWork .. _doxid-classfuncmin_1_1_rgmin_opt_1a9223de4c9ba86dcfd690edfc568b09a8: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t physicalObjectiveWork() const Executed objective-count units, including final holder restoration. .. index:: pair: function; methodFromName .. _doxid-classfuncmin_1_1_rgmin_opt_1a689274fab9ae74ecc57aa13a1958791f: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool methodFromName(const char* name, rgmin_method_t& out) Map a ``rgmin:`` spelling onto the solver enum. Newton and RFO are absent on purpose: both need an analytic Hessian of the marginal likelihood, which the MAP objective does not supply. Accepting their names here would build a session that cannot take a step.