.. index:: pair: class; gpr::neb::LocalCartesianGP .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p: class gpr::neb::LocalCartesianGP ================================ .. toctree:: :hidden: struct_gpr_neb_LocalCartesianGP_Observation.rst Overview ~~~~~~~~ Squared-exponential Gaussian process with partial gradients. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class LocalCartesianGP { public: // structs struct :ref:`Observation`; // construction :target:`LocalCartesianGP`(Eigen::Index input_dim, std::vector gradient_dofs); // methods Eigen::Index :target:`inputDim`() const; Eigen::Index :target:`gradientDim`() const; const std::vector& :target:`gradientDofs`() const; int :target:`size`() const; void :ref:`setNoise`(double energy_sigma, double gradient_sigma); void :ref:`setWindow`(int max_observations); void :ref:`setLengthScaleBounds`(double lower, double upper); void :ref:`setHyperparameters`(double signal_variance, double length_scale); void :ref:`setHyperparametersFromData`(double factor); bool :ref:`add`(const Eigen::VectorXd& x, double energy, const Eigen::VectorXd& local_gradient, double duplicate_distance = 1e-7); double :ref:`fit`(int max_iterations, const std::function& stop_requested = {}); void :ref:`condition`(); bool :target:`ready`() const; void :ref:`predict`(const Eigen::VectorXd& x, double& energy, Eigen::VectorXd& local_gradient) const; double :ref:`energyVariance`(const Eigen::VectorXd& x) const; double :target:`signalVariance`() const; double :target:`lengthScale`() const; double :target:`mean`() const; double :ref:`negativeLogMarginalLikelihood`() const; double :ref:`objective`(const Eigen::Vector2d& theta, Eigen::Vector2d& gradient) const; }; .. _details-classgpr_1_1neb_1_1_local_cartesian_g_p: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Squared-exponential Gaussian process with partial gradients. The input is the full Cartesian vector of a band image, so two images that differ only in their substrate are distinct inputs and the data stay consistent. Every observation supplies the energy and the gradient on a fixed subset of coordinates, the atoms that carry the band's motion, so an observation adds one row per local coordinate plus one. The kernel is isotropic with one length scale, the mean is the highest retained energy, and the noise is fixed per channel. The factorisation grows by appended rows between window evictions. Methods ------- .. index:: pair: function; setNoise .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1a7fc80ddafc169336bc61fa44260b3810: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setNoise(double energy_sigma, double gradient_sigma) Standard deviation of the energy and gradient channels. .. index:: pair: function; setWindow .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1a97665084e893232052c9257a33b6b8d8: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setWindow(int max_observations) Retain at most this many observations; the oldest quarter leaves together once the window overflows. .. index:: pair: function; setLengthScaleBounds .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1a691bd904ba4ace591480e7cfc025f8f5: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setLengthScaleBounds(double lower, double upper) Admissible length scale range in input units. .. index:: pair: function; setHyperparameters .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1a68cce0f7fb0452cb910d0a41cb2021d1: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setHyperparameters(double signal_variance, double length_scale) Seed hyperparameters before the first fit. .. index:: pair: function; setHyperparametersFromData .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1a99dd17c18a42a6cdeda759ac03136d70: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setHyperparametersFromData(double factor) Length scale from the median nearest-neighbour spacing of the retained inputs times ``factor``, and the signal variance from the spread of the retained energies. .. index:: pair: function; add .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1ae53e7081c16038a22c7c47f3c17b2341: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool add(const Eigen::VectorXd& x, double energy, const Eigen::VectorXd& local_gradient, double duplicate_distance = 1e-7) Append an observation. ``:ref:`x ``` is the full input and ``local_gradient`` the gradient on the gradient coordinates. An input within ``duplicate_distance`` of a retained observation replaces that observation. Nonfinite values are rejected and the model is unchanged. .. index:: pair: function; fit .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1a7df246f67c74d33e1ad8fa3462484606: .. ref-code-block:: cpp :class: doxyrest-title-code-block double fit(int max_iterations, const std::function& stop_requested = {}) Maximise the marginal likelihood over (signal variance, length scale) with at most ``max_iterations`` quasi-Newton iterations, then condition. Returns the negative log marginal likelihood. .. index:: pair: function; condition .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1a809c1486e6a42021aba2343aa33a2fbc: .. ref-code-block:: cpp :class: doxyrest-title-code-block void condition() Condition the posterior on the retained observations with the current hyperparameters, appending rows when the retained set only grew since the last conditioning. .. index:: pair: function; predict .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1aac5f013bfce80c6a63f32cca7f4fa185: .. ref-code-block:: cpp :class: doxyrest-title-code-block void predict(const Eigen::VectorXd& x, double& energy, Eigen::VectorXd& local_gradient) const Posterior mean energy and gradient on the gradient coordinates. .. index:: pair: function; energyVariance .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1a1ad211b954c499b19fccc5ad5b143d70: .. ref-code-block:: cpp :class: doxyrest-title-code-block double energyVariance(const Eigen::VectorXd& x) const Posterior energy variance at x. .. index:: pair: function; negativeLogMarginalLikelihood .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1a41c5018c589540efb382314dc37bda73: .. ref-code-block:: cpp :class: doxyrest-title-code-block double negativeLogMarginalLikelihood() const Negative log marginal likelihood at the current hyperparameters. .. index:: pair: function; objective .. _doxid-classgpr_1_1neb_1_1_local_cartesian_g_p_1aab83a398d7e36b3829172b0e4006724d: .. ref-code-block:: cpp :class: doxyrest-title-code-block double objective(const Eigen::Vector2d& theta, Eigen::Vector2d& gradient) const Negative log marginal likelihood and its gradient with respect to (log signal variance, log length scale).