pub struct GaussianProcessModel {
pub x_train: Vec<Vec<f64>>,
pub y_train: Vec<f64>,
pub config: GaussianProcessConfig,
pub hyperparameters: GPHyperparameters,
/* private fields */
}Expand description
Gaussian Process regression model.
Conditioned on training data, this model provides posterior mean and variance
predictions via an exact Cholesky-based solve of K + σ²I.
Fields§
§x_train: Vec<Vec<f64>>Training input data
y_train: Vec<f64>Training output data
config: GaussianProcessConfigGP configuration
hyperparameters: GPHyperparametersLearned hyperparameters
Implementations§
Source§impl GaussianProcessModel
impl GaussianProcessModel
Sourcepub fn new(
x_train: Vec<Vec<f64>>,
y_train: Vec<f64>,
config: GaussianProcessConfig,
) -> BayesianOptResult<Self>
pub fn new( x_train: Vec<Vec<f64>>, y_train: Vec<f64>, config: GaussianProcessConfig, ) -> BayesianOptResult<Self>
Create new Gaussian Process model
Sourcepub fn fit(&mut self) -> BayesianOptResult<()>
pub fn fit(&mut self) -> BayesianOptResult<()>
Fit the Gaussian Process model.
Sets heuristic hyperparameters, then Cholesky-factorizes K + σ²I and
precomputes α for fast predictive-mean evaluation.
Sourcepub fn predict(&self, x: &[f64]) -> BayesianOptResult<(f64, f64)>
pub fn predict(&self, x: &[f64]) -> BayesianOptResult<(f64, f64)>
Predict the posterior mean and variance at a new point.
Implements the exact-GP predictive equations:
μ(x*) = m(x*) + k*ᵀ α and σ²(x*) = k(x*, x*) − vᵀ v with v = L⁻¹ k*.
Sourcepub fn log_marginal_likelihood(&self) -> BayesianOptResult<f64>
pub fn log_marginal_likelihood(&self) -> BayesianOptResult<f64>
Exact log marginal likelihood of the training data under the fitted GP.
log p(y) = −½ (y − m)ᵀ α − Σ ln L_ii − ½ n ln(2π), where the middle term
equals ½ ln|K + σ²I| because L is the Cholesky factor.
Trait Implementations§
Source§impl Clone for GaussianProcessModel
impl Clone for GaussianProcessModel
Source§fn clone(&self) -> GaussianProcessModel
fn clone(&self) -> GaussianProcessModel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GaussianProcessModel
impl RefUnwindSafe for GaussianProcessModel
impl Send for GaussianProcessModel
impl Sync for GaussianProcessModel
impl Unpin for GaussianProcessModel
impl UnsafeUnpin for GaussianProcessModel
impl UnwindSafe for GaussianProcessModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.