pub trait SurrogateModel {
// Required methods
fn fit(&mut self, x: &Array2<f64>, y: &Array1<f64>) -> OptimizeResult<()>;
fn predict(&self, x: &Array1<f64>) -> OptimizeResult<f64>;
fn predict_with_uncertainty(
&self,
x: &Array1<f64>,
) -> OptimizeResult<(f64, f64)>;
fn n_samples(&self) -> usize;
fn n_features(&self) -> usize;
fn update(&mut self, x: &Array1<f64>, y: f64) -> OptimizeResult<()>;
// Provided method
fn predict_batch(&self, x: &Array2<f64>) -> OptimizeResult<Array1<f64>> { ... }
}Expand description
Common trait for surrogate models
Required Methods§
Sourcefn fit(&mut self, x: &Array2<f64>, y: &Array1<f64>) -> OptimizeResult<()>
fn fit(&mut self, x: &Array2<f64>, y: &Array1<f64>) -> OptimizeResult<()>
Fit the surrogate model to the provided data
§Arguments
x- Training points, shape (n_samples, n_features)y- Function values at training points, shape (n_samples,)
Sourcefn predict_with_uncertainty(
&self,
x: &Array1<f64>,
) -> OptimizeResult<(f64, f64)>
fn predict_with_uncertainty( &self, x: &Array1<f64>, ) -> OptimizeResult<(f64, f64)>
Sourcefn n_features(&self) -> usize
fn n_features(&self) -> usize
Get the dimensionality of the problem