pub struct GpSurrogate { /* private fields */ }Expand description
Gaussian Process surrogate model for Bayesian optimization.
Maintains training data and the fitted model (Cholesky factor + alpha vector) for efficient prediction.
Implementations§
Source§impl GpSurrogate
impl GpSurrogate
Sourcepub fn new(kernel: Box<dyn SurrogateKernel>, config: GpSurrogateConfig) -> Self
pub fn new(kernel: Box<dyn SurrogateKernel>, config: GpSurrogateConfig) -> Self
Create a new GP surrogate with the given kernel.
Sourcepub fn default_rbf() -> Self
pub fn default_rbf() -> Self
Create a GP surrogate with an RBF kernel and default configuration.
Sourcepub fn fit(&mut self, x: &Array2<f64>, y: &Array1<f64>) -> OptimizeResult<()>
pub fn fit(&mut self, x: &Array2<f64>, y: &Array1<f64>) -> OptimizeResult<()>
Fit the GP to training data.
Optionally optimises kernel hyperparameters via marginal likelihood maximisation.
Sourcepub fn update(
&mut self,
x_new: &Array2<f64>,
y_new: &Array1<f64>,
) -> OptimizeResult<()>
pub fn update( &mut self, x_new: &Array2<f64>, y_new: &Array1<f64>, ) -> OptimizeResult<()>
Add new observations incrementally and refit the model.
Sourcepub fn predict_mean(&self, x_test: &Array2<f64>) -> OptimizeResult<Array1<f64>>
pub fn predict_mean(&self, x_test: &Array2<f64>) -> OptimizeResult<Array1<f64>>
Predict the GP mean at test points.
Sourcepub fn predict_variance(
&self,
x_test: &Array2<f64>,
) -> OptimizeResult<Array1<f64>>
pub fn predict_variance( &self, x_test: &Array2<f64>, ) -> OptimizeResult<Array1<f64>>
Predict the GP variance at test points.
Sourcepub fn predict(
&self,
x_test: &Array2<f64>,
) -> OptimizeResult<(Array1<f64>, Array1<f64>)>
pub fn predict( &self, x_test: &Array2<f64>, ) -> OptimizeResult<(Array1<f64>, Array1<f64>)>
Predict both mean and variance at test points.
Sourcepub fn predict_single(
&self,
x: &ArrayView1<'_, f64>,
) -> OptimizeResult<(f64, f64)>
pub fn predict_single( &self, x: &ArrayView1<'_, f64>, ) -> OptimizeResult<(f64, f64)>
Predict mean and standard deviation at a single point.
Sourcepub fn log_marginal_likelihood(&self) -> OptimizeResult<f64>
pub fn log_marginal_likelihood(&self) -> OptimizeResult<f64>
Compute the log marginal likelihood of the current model.
Sourcepub fn kernel(&self) -> &dyn SurrogateKernel
pub fn kernel(&self) -> &dyn SurrogateKernel
Return a reference to the current kernel.
Sourcepub fn kernel_mut(&mut self) -> &mut dyn SurrogateKernel
pub fn kernel_mut(&mut self) -> &mut dyn SurrogateKernel
Return a mutable reference to the kernel.
Auto Trait Implementations§
impl Freeze for GpSurrogate
impl !RefUnwindSafe for GpSurrogate
impl Send for GpSurrogate
impl Sync for GpSurrogate
impl Unpin for GpSurrogate
impl UnsafeUnpin for GpSurrogate
impl !UnwindSafe for GpSurrogate
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
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
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.