.. index:: pair: class; gpr::bo::ParameterSearch .. _doxid-classgpr_1_1bo_1_1_parameter_search: class gpr::bo::ParameterSearch ============================== .. toctree:: :hidden: struct_gpr_bo_ParameterSearch_Incumbent.rst struct_gpr_bo_ParameterSearch_Model.rst Overview ~~~~~~~~ Ask-and-tell minimization of a noisy loss over a parameter box. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class ParameterSearch { public: // structs struct :ref:`Incumbent`; struct :ref:`Model`; // construction :target:`ParameterSearch`(std::vector<:ref:`ParameterBound`> bounds, :ref:`ParameterSearchConfig` config = {}); // methods int :target:`dimension`() const; int :target:`observationCount`() const; const :ref:`ParameterSearchConfig`& :target:`config`() const; const std::vector<:ref:`ParameterBound`>& :target:`bounds`() const; void :ref:`observe`(const :ref:`ParameterObservation`& observation); void :ref:`observe`(const Eigen::VectorXd& parameters, double loss); void :ref:`observe`(const Eigen::VectorXd& parameters, double loss, double noise_variance); std::vector :ref:`propose`(int count); :ref:`ParameterSearchResult` :ref:`best`(); void :ref:`predict`(const Eigen::MatrixXd& parameters, Eigen::VectorXd& mean, Eigen::VectorXd& standard_deviation); void :ref:`predictFeasibility`(const Eigen::MatrixXd& parameters, Eigen::VectorXd& probability); const :ref:`ScalarHyperparameters`& :ref:`hyperparameters`(); }; .. _details-classgpr_1_1bo_1_1_parameter_search: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Ask-and-tell minimization of a noisy loss over a parameter box. The caller evaluates the loss. :ref:`observe() ` records one result, with its noise variance when the caller knows it, and :ref:`propose() ` returns the next parameter vectors to run. The surrogate is a :ref:`ScalarSurrogate ` on the unit cube, fitted to losses standardized to zero mean and unit variance. propose(q) builds a batch with the constant liar heuristic of Ginsbourger, Le Riche and Carraro (2010): after each pick the surrogate is conditioned on a made-up observation at that point, whose value is the incumbent (the "CL-min" lie), and the acquisition is maximized again. The hyperparameters are not refitted on the lies. The q points can then be evaluated together, for example in one allocation. An observation may carry a constraint value c(x), feasible when c(x) <= 0. A second scalar GP models c, and expected improvement is multiplied by the probability of feasibility P(c(x) <= 0), as in Gardner et al. (2014) and Gelbart, Snoek and Adams (2014). The feasibility model is a GP regression on the constraint value, or on labels -1 (feasible) and +1 (infeasible) when only the outcome is known. It is not a classification likelihood: with labels the probability is a heuristic score and is not calibrated. With :ref:`ParameterSearchConfig::noisy_objective ` the incumbent is the smallest posterior mean at the evaluated points instead of the smallest observed loss: the plug-in form of expected improvement for a noisy oracle, reviewed by Picheny, Wagner and Ginsbourger (2013). One lucky noisy run then does not set the bar every later candidate has to beat. Methods ------- .. index:: pair: function; observe .. _doxid-classgpr_1_1bo_1_1_parameter_search_1aaa415dde473ef2f95d3f45019deebdf6: .. ref-code-block:: cpp :class: doxyrest-title-code-block void observe(const :ref:`ParameterObservation`& observation) Record one evaluated parameter vector. The parameters are moved to the lattice of their axes and clamped to the box. Either every observation carries a noise variance or none does; a mixture throws std::invalid_argument. A run that produced no loss is recorded with a non-finite loss and a positive constraint: it informs the feasibility model only. .. index:: pair: function; observe .. _doxid-classgpr_1_1bo_1_1_parameter_search_1ae807d110ee1dbc09be357a0a205f7209: .. ref-code-block:: cpp :class: doxyrest-title-code-block void observe(const Eigen::VectorXd& parameters, double loss) Record a loss observed with the shared noise variance. .. index:: pair: function; observe .. _doxid-classgpr_1_1bo_1_1_parameter_search_1a049f158cef4777242a1619a59eb7fd5a: .. ref-code-block:: cpp :class: doxyrest-title-code-block void observe(const Eigen::VectorXd& parameters, double loss, double noise_variance) Record a loss observed with its own noise variance. .. index:: pair: function; propose .. _doxid-classgpr_1_1bo_1_1_parameter_search_1affe337fc0573e4b4cc47c7d1c3456e1d: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector propose(int count) Propose up to count parameter vectors to evaluate next. Without observations the points are the next ones of a Halton sequence. Otherwise they maximize the acquisition one after the other under the constant liar. Before any feasible loss is known the acquisition is the probability of feasibility alone. Fewer than count vectors come back when the box holds fewer unevaluated lattice points. .. index:: pair: function; best .. _doxid-classgpr_1_1bo_1_1_parameter_search_1af9b4af3c6fec0ee2ccd30dd162475358: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ParameterSearchResult` best() The incumbent, its loss and the number of observations. The incumbent is the feasible evaluated parameter vector with the smallest loss. With noisy_objective it is the one with the smallest posterior mean, and loss is that mean. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - std::logic_error - without a feasible observation. .. index:: pair: function; predict .. _doxid-classgpr_1_1bo_1_1_parameter_search_1aee182afd647ab57193ae756f20c4a82e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void predict(const Eigen::MatrixXd& parameters, Eigen::VectorXd& mean, Eigen::VectorXd& standard_deviation) Surrogate prediction of the latent loss, in the units of the observed losses, at each row of parameters. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - std::logic_error - without an observed loss. .. index:: pair: function; predictFeasibility .. _doxid-classgpr_1_1bo_1_1_parameter_search_1aae8f1263707fe63ea7890860a15f7326: .. ref-code-block:: cpp :class: doxyrest-title-code-block void predictFeasibility(const Eigen::MatrixXd& parameters, Eigen::VectorXd& probability) Probability of feasibility P(c(x) <= 0) at each row of parameters. One everywhere while no constraint value is observed. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - std::logic_error - without observations. .. index:: pair: function; hyperparameters .. _doxid-classgpr_1_1bo_1_1_parameter_search_1ab4384956a2a9b0dbce7010d66bd50d89: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`ScalarHyperparameters`& hyperparameters() Hyperparameters of the loss surrogate, on the unit cube and for the standardized loss. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - std::logic_error - without an observed loss.