Skip to main content

SurrogateKernel

Trait SurrogateKernel 

Source
pub trait SurrogateKernel: Send + Sync {
    // Required methods
    fn eval(&self, x1: &ArrayView1<'_, f64>, x2: &ArrayView1<'_, f64>) -> f64;
    fn get_log_params(&self) -> Vec<f64>;
    fn set_log_params(&mut self, params: &[f64]);
    fn clone_box(&self) -> Box<dyn SurrogateKernel>;
    fn name(&self) -> &str;

    // Provided methods
    fn covariance_matrix(&self, x: &Array2<f64>) -> Array2<f64> { ... }
    fn cross_covariance(
        &self,
        x1: &Array2<f64>,
        x2: &Array2<f64>,
    ) -> Array2<f64> { ... }
    fn n_params(&self) -> usize { ... }
}
Expand description

Trait for covariance (kernel) functions used by the GP surrogate.

Required Methods§

Source

fn eval(&self, x1: &ArrayView1<'_, f64>, x2: &ArrayView1<'_, f64>) -> f64

Evaluate the kernel between two input vectors.

Source

fn get_log_params(&self) -> Vec<f64>

Return current hyperparameters as a flat vector (log-scale).

Source

fn set_log_params(&mut self, params: &[f64])

Set hyperparameters from a flat vector (log-scale).

Source

fn clone_box(&self) -> Box<dyn SurrogateKernel>

Clone the kernel into a boxed trait object.

Source

fn name(&self) -> &str

Name of the kernel (for debug display).

Provided Methods§

Source

fn covariance_matrix(&self, x: &Array2<f64>) -> Array2<f64>

Compute the full covariance matrix for a set of inputs.

Source

fn cross_covariance(&self, x1: &Array2<f64>, x2: &Array2<f64>) -> Array2<f64>

Compute the cross-covariance matrix between two sets of inputs.

Source

fn n_params(&self) -> usize

Number of hyperparameters.

Trait Implementations§

Source§

impl Clone for Box<dyn SurrogateKernel>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§