Squared-exponential Gaussian process with partial gradients. More...
#include <gpr/neb/LocalGP.h>
Public Member Functions | |
| LocalCartesianGP (Eigen::Index input_dim, std::vector< Eigen::Index > gradient_dofs) | |
| Eigen::Index | inputDim () const noexcept |
| Eigen::Index | gradientDim () const noexcept |
| const std::vector< Eigen::Index > & | gradientDofs () const noexcept |
| int | size () const noexcept |
| void | setNoise (double energy_sigma, double gradient_sigma) |
| Standard deviation of the energy and gradient channels. | |
| void | setWindow (int max_observations) |
| void | setLengthScaleBounds (double lower, double upper) |
| Admissible length scale range in input units. | |
| void | setHyperparameters (double signal_variance, double length_scale) |
| Seed hyperparameters before the first fit. | |
| void | setHyperparametersFromData (double factor) |
| bool | add (const Eigen::VectorXd &x, double energy, const Eigen::VectorXd &local_gradient, double duplicate_distance=1e-7) |
| Append an observation. | |
| double | fit (int max_iterations, const std::function< bool()> &stop_requested={}) |
| void | condition () |
| bool | ready () const noexcept |
| void | predict (const Eigen::VectorXd &x, double &energy, Eigen::VectorXd &local_gradient) const |
| Posterior mean energy and gradient on the gradient coordinates. | |
| double | energyVariance (const Eigen::VectorXd &x) const |
| Posterior energy variance at x. | |
| double | signalVariance () const noexcept |
| double | lengthScale () const noexcept |
| double | mean () const noexcept |
| double | negativeLogMarginalLikelihood () const |
| Negative log marginal likelihood at the current hyperparameters. | |
| double | objective (const Eigen::Vector2d &theta, Eigen::Vector2d &gradient) const |
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.
| gpr::neb::LocalCartesianGP::LocalCartesianGP | ( | Eigen::Index | input_dim, |
| std::vector< Eigen::Index > | gradient_dofs ) |
Definition at line 18 of file LocalGP.cpp.
| bool gpr::neb::LocalCartesianGP::add | ( | const Eigen::VectorXd & | x, |
| double | energy, | ||
| const Eigen::VectorXd & | local_gradient, | ||
| double | duplicate_distance = 1e-7 ) |
Append an observation.
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.
Definition at line 95 of file LocalGP.cpp.
| void gpr::neb::LocalCartesianGP::condition | ( | ) |
Condition the posterior on the retained observations with the current hyperparameters, appending rows when the retained set only grew since the last conditioning.
Definition at line 389 of file LocalGP.cpp.
| double gpr::neb::LocalCartesianGP::energyVariance | ( | const Eigen::VectorXd & | x | ) | const |
Posterior energy variance at x.
Definition at line 438 of file LocalGP.cpp.
| double gpr::neb::LocalCartesianGP::fit | ( | int | max_iterations, |
| const std::function< bool()> & | 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.
Definition at line 255 of file LocalGP.cpp.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
| double gpr::neb::LocalCartesianGP::negativeLogMarginalLikelihood | ( | ) | const |
Negative log marginal likelihood at the current hyperparameters.
Definition at line 249 of file LocalGP.cpp.
| double gpr::neb::LocalCartesianGP::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).
Definition at line 210 of file LocalGP.cpp.
| void gpr::neb::LocalCartesianGP::predict | ( | const Eigen::VectorXd & | x, |
| double & | energy, | ||
| Eigen::VectorXd & | local_gradient ) const |
Posterior mean energy and gradient on the gradient coordinates.
Definition at line 425 of file LocalGP.cpp.
|
inlinenoexcept |
| void gpr::neb::LocalCartesianGP::setHyperparameters | ( | double | signal_variance, |
| double | length_scale ) |
Seed hyperparameters before the first fit.
Definition at line 57 of file LocalGP.cpp.
| void gpr::neb::LocalCartesianGP::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.
Definition at line 68 of file LocalGP.cpp.
| void gpr::neb::LocalCartesianGP::setLengthScaleBounds | ( | double | lower, |
| double | upper ) |
Admissible length scale range in input units.
Definition at line 45 of file LocalGP.cpp.
| void gpr::neb::LocalCartesianGP::setNoise | ( | double | energy_sigma, |
| double | gradient_sigma ) |
Standard deviation of the energy and gradient channels.
Definition at line 26 of file LocalGP.cpp.
| void gpr::neb::LocalCartesianGP::setWindow | ( | int | max_observations | ) |
Retain at most this many observations; the oldest quarter leaves together once the window overflows.
Definition at line 34 of file LocalGP.cpp.
|
inlinenoexcept |
|
inlinenoexcept |