pub struct VariationalSparseGaussianProcessRegressor<S = Untrained> { /* private fields */ }Expand description
let X = array![[0.0], [1.0], [2.0], [3.0], [4.0], [5.0], [6.0], [7.0]]; let y = array![0.0, 1.0, 4.0, 9.0, 16.0, 25.0, 36.0, 49.0];
let kernel = RBF::new(2.0); let vsgpr = VariationalSparseGaussianProcessRegressor::new() .kernel(Box::new(kernel)) .n_inducing(3); let fitted = vsgpr.fit(&X.view(), &y.view()).unwrap(); let predictions = fitted.predict(&X.view()).unwrap();
Implementations§
Source§impl VariationalSparseGaussianProcessRegressor<Untrained>
impl VariationalSparseGaussianProcessRegressor<Untrained>
Sourcepub fn n_inducing(self, n_inducing: usize) -> Self
pub fn n_inducing(self, n_inducing: usize) -> Self
Set the number of inducing points
Sourcepub fn inducing_init(self, inducing_init: InducingPointInit) -> Self
pub fn inducing_init(self, inducing_init: InducingPointInit) -> Self
Set the inducing point initialization method
Sourcepub fn learning_rate(self, learning_rate: f64) -> Self
pub fn learning_rate(self, learning_rate: f64) -> Self
Set the learning rate for optimization
Sourcepub fn batch_size(self, batch_size: Option<usize>) -> Self
pub fn batch_size(self, batch_size: Option<usize>) -> Self
Set the batch size for mini-batch optimization
Sourcepub fn inducing_batch_size(self, inducing_batch_size: Option<usize>) -> Self
pub fn inducing_batch_size(self, inducing_batch_size: Option<usize>) -> Self
Set the inducing batch size for doubly stochastic optimization
Sourcepub fn random_state(self, random_state: Option<u64>) -> Self
pub fn random_state(self, random_state: Option<u64>) -> Self
Set the random state
Sourcepub fn optimizer(self, optimizer: VariationalOptimizer) -> Self
pub fn optimizer(self, optimizer: VariationalOptimizer) -> Self
Set the optimization method
Sourcepub fn natural_gradient_damping(self, damping: f64) -> Self
pub fn natural_gradient_damping(self, damping: f64) -> Self
Set the damping factor for natural gradients (only used when optimizer is NaturalGradients)
Source§impl VariationalSparseGaussianProcessRegressor<VsgprTrained>
impl VariationalSparseGaussianProcessRegressor<VsgprTrained>
Sourcepub fn predict_with_std(
&self,
X: &ArrayView2<'_, f64>,
) -> SklResult<(Array1<f64>, Array1<f64>)>
pub fn predict_with_std( &self, X: &ArrayView2<'_, f64>, ) -> SklResult<(Array1<f64>, Array1<f64>)>
Predict with uncertainty estimates
Sourcepub fn elbo_history(&self) -> &[f64]
pub fn elbo_history(&self) -> &[f64]
Get the ELBO history during training
Sourcepub fn inducing_points(&self) -> &Array2<f64>
pub fn inducing_points(&self) -> &Array2<f64>
Get the inducing points
Sourcepub fn variational_mean(&self) -> &Array1<f64>
pub fn variational_mean(&self) -> &Array1<f64>
Get the variational mean
Sourcepub fn variational_covariance(&self) -> &Array2<f64>
pub fn variational_covariance(&self) -> &Array2<f64>
Get the variational covariance
Sourcepub fn update(
self,
X_new: &ArrayView2<'_, f64>,
y_new: &ArrayView1<'_, f64>,
learning_rate: Option<f64>,
n_iterations: Option<usize>,
) -> SklResult<Self>
pub fn update( self, X_new: &ArrayView2<'_, f64>, y_new: &ArrayView1<'_, f64>, learning_rate: Option<f64>, n_iterations: Option<usize>, ) -> SklResult<Self>
Online update with new data for streaming/scalable learning
This method allows incrementally updating the variational parameters with new data points without retraining from scratch, making it suitable for streaming scenarios and very large datasets.
§Arguments
X_new- New input data pointsy_new- New target valueslearning_rate- Learning rate for the update (if None, uses model’s learning rate)n_iterations- Number of update iterations (default: 10)
§Returns
Updated model with modified variational parameters
Sourcepub fn recursive_update(
self,
X_new: &ArrayView2<'_, f64>,
y_new: &ArrayView1<'_, f64>,
forgetting_factor: Option<f64>,
) -> SklResult<Self>
pub fn recursive_update( self, X_new: &ArrayView2<'_, f64>, y_new: &ArrayView1<'_, f64>, forgetting_factor: Option<f64>, ) -> SklResult<Self>
Recursive Bayesian update for online GP learning
This method implements proper recursive Bayesian updates for Gaussian processes, maintaining the posterior mean and covariance through sequential updates without requiring full recomputation of the ELBO.
§Arguments
X_new- New input data (n_new x n_features)y_new- New target values (n_new,)forgetting_factor- Exponential forgetting factor (0 < λ ≤ 1)
§Returns
Updated model with recursively updated posterior
Sourcepub fn sliding_window_update(
self,
X_new: &ArrayView2<'_, f64>,
y_new: &ArrayView1<'_, f64>,
window_size: usize,
decay_rate: f64,
) -> SklResult<Self>
pub fn sliding_window_update( self, X_new: &ArrayView2<'_, f64>, y_new: &ArrayView1<'_, f64>, window_size: usize, decay_rate: f64, ) -> SklResult<Self>
Sliding window update for streaming data
Maintains a sliding window of recent data points and uses exponential forgetting to down-weight older observations.
§Arguments
X_new- New input datay_new- New target valueswindow_size- Maximum number of recent observations to maintaindecay_rate- Exponential decay rate for older observations
Sourcepub fn adaptive_sparse_update(
self,
X_new: &ArrayView2<'_, f64>,
y_new: &ArrayView1<'_, f64>,
max_inducing: usize,
quality_threshold: f64,
removal_threshold: f64,
) -> SklResult<Self>
pub fn adaptive_sparse_update( self, X_new: &ArrayView2<'_, f64>, y_new: &ArrayView1<'_, f64>, max_inducing: usize, quality_threshold: f64, removal_threshold: f64, ) -> SklResult<Self>
Adaptive sparse GP with dynamic inducing point management
This method adaptively adds/removes inducing points based on the approximation quality and computational budget, maintaining good approximation while controlling computational cost.
§Arguments
X_new- New input datay_new- New target valuesmax_inducing- Maximum number of inducing points allowedquality_threshold- Minimum approximation quality threshold (0.0-1.0)removal_threshold- Threshold for removing redundant inducing points
§Returns
Updated model with adaptively adjusted inducing points
Trait Implementations§
Source§impl<S: Clone> Clone for VariationalSparseGaussianProcessRegressor<S>
impl<S: Clone> Clone for VariationalSparseGaussianProcessRegressor<S>
Source§fn clone(&self) -> VariationalSparseGaussianProcessRegressor<S>
fn clone(&self) -> VariationalSparseGaussianProcessRegressor<S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<S: Debug> Debug for VariationalSparseGaussianProcessRegressor<S>
impl<S: Debug> Debug for VariationalSparseGaussianProcessRegressor<S>
Source§impl Estimator for VariationalSparseGaussianProcessRegressor<Untrained>
impl Estimator for VariationalSparseGaussianProcessRegressor<Untrained>
Source§type Error = SklearsError
type Error = SklearsError
Source§fn validate_config(&self) -> Result<(), SklearsError>
fn validate_config(&self) -> Result<(), SklearsError>
Source§fn check_compatibility(
&self,
n_samples: usize,
n_features: usize,
) -> Result<(), SklearsError>
fn check_compatibility( &self, n_samples: usize, n_features: usize, ) -> Result<(), SklearsError>
Source§fn metadata(&self) -> EstimatorMetadata
fn metadata(&self) -> EstimatorMetadata
Source§impl Estimator for VariationalSparseGaussianProcessRegressor<VsgprTrained>
impl Estimator for VariationalSparseGaussianProcessRegressor<VsgprTrained>
Source§type Error = SklearsError
type Error = SklearsError
Source§fn validate_config(&self) -> Result<(), SklearsError>
fn validate_config(&self) -> Result<(), SklearsError>
Source§fn check_compatibility(
&self,
n_samples: usize,
n_features: usize,
) -> Result<(), SklearsError>
fn check_compatibility( &self, n_samples: usize, n_features: usize, ) -> Result<(), SklearsError>
Source§fn metadata(&self) -> EstimatorMetadata
fn metadata(&self) -> EstimatorMetadata
Source§impl Fit<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>> for VariationalSparseGaussianProcessRegressor<Untrained>
impl Fit<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>> for VariationalSparseGaussianProcessRegressor<Untrained>
Source§type Fitted = VariationalSparseGaussianProcessRegressor<VsgprTrained>
type Fitted = VariationalSparseGaussianProcessRegressor<VsgprTrained>
Source§fn fit(
self,
X: &ArrayView2<'_, f64>,
y: &ArrayView1<'_, f64>,
) -> SklResult<Self::Fitted>
fn fit( self, X: &ArrayView2<'_, f64>, y: &ArrayView1<'_, f64>, ) -> SklResult<Self::Fitted>
Source§fn fit_with_validation(
self,
x: &X,
y: &Y,
_x_val: Option<&X>,
_y_val: Option<&Y>,
) -> Result<(Self::Fitted, FitMetrics), SklearsError>where
Self: Sized,
fn fit_with_validation(
self,
x: &X,
y: &Y,
_x_val: Option<&X>,
_y_val: Option<&Y>,
) -> Result<(Self::Fitted, FitMetrics), SklearsError>where
Self: Sized,
Source§impl Predict<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for VariationalSparseGaussianProcessRegressor<VsgprTrained>
impl Predict<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for VariationalSparseGaussianProcessRegressor<VsgprTrained>
Source§fn predict(&self, X: &ArrayView2<'_, f64>) -> SklResult<Array1<f64>>
fn predict(&self, X: &ArrayView2<'_, f64>) -> SklResult<Array1<f64>>
Source§fn predict_with_uncertainty(
&self,
x: &X,
) -> Result<(Output, UncertaintyMeasure), SklearsError>
fn predict_with_uncertainty( &self, x: &X, ) -> Result<(Output, UncertaintyMeasure), SklearsError>
Auto Trait Implementations§
impl<S> Freeze for VariationalSparseGaussianProcessRegressor<S>where
S: Freeze,
impl<S = Untrained> !RefUnwindSafe for VariationalSparseGaussianProcessRegressor<S>
impl<S> Send for VariationalSparseGaussianProcessRegressor<S>where
S: Send,
impl<S> Sync for VariationalSparseGaussianProcessRegressor<S>where
S: Sync,
impl<S> Unpin for VariationalSparseGaussianProcessRegressor<S>where
S: Unpin,
impl<S = Untrained> !UnwindSafe for VariationalSparseGaussianProcessRegressor<S>
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> 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 more