Skip to main content

CorrelationModel

Trait CorrelationModel 

Source
pub trait CorrelationModel<F: Float>:
    Clone
    + Copy
    + Default
    + Display
    + Sync {
    // Required methods
    fn rval_from_distances(
        &self,
        distances: &ArrayBase<impl Data<Elem = F>, Ix2>,
        theta: &ArrayBase<impl Data<Elem = F>, Ix1>,
        weights: &ArrayBase<impl Data<Elem = F>, Ix2>,
    ) -> Array2<F>;
    fn jac(
        &self,
        x: &ArrayBase<impl Data<Elem = F>, Ix1>,
        xtrain: &ArrayBase<impl Data<Elem = F>, Ix2>,
        theta: &ArrayBase<impl Data<Elem = F>, Ix1>,
        weights: &ArrayBase<impl Data<Elem = F>, Ix2>,
    ) -> Array2<F>;
    fn rval_with_jac(
        &self,
        x: &ArrayBase<impl Data<Elem = F>, Ix1>,
        xtrain: &ArrayBase<impl Data<Elem = F>, Ix2>,
        theta: &ArrayBase<impl Data<Elem = F>, Ix1>,
        weights: &ArrayBase<impl Data<Elem = F>, Ix2>,
    ) -> (Array2<F>, Array2<F>);

    // Provided methods
    fn rval(
        &self,
        x: &ArrayBase<impl Data<Elem = F>, Ix1>,
        xtrain: &ArrayBase<impl Data<Elem = F>, Ix2>,
        theta: &ArrayBase<impl Data<Elem = F>, Ix1>,
        weights: &ArrayBase<impl Data<Elem = F>, Ix2>,
    ) -> Array2<F> { ... }
    fn theta_influence_factors(&self) -> (F, F) { ... }
}
Expand description

A trait for using a correlation model in GP regression

Required Methods§

Source

fn rval_from_distances( &self, distances: &ArrayBase<impl Data<Elem = F>, Ix2>, theta: &ArrayBase<impl Data<Elem = F>, Ix1>, weights: &ArrayBase<impl Data<Elem = F>, Ix2>, ) -> Array2<F>

Compute correlation function r(x, x’) given distances distances between x and x’, theta parameters, and PLS weights with:

  • distances : distances (nxd)
  • theta : hyperparameters (d,)
  • weights : PLS weights (dxh) where d is the initial dimension and h (<d) is the reduced dimension when PLS is used (kpls_dim)

The returned correlation function matrix has shape (nt x 1) and corresponds to r(x, xtrain) where r is the correlation function defined by the model.

Source

fn jac( &self, x: &ArrayBase<impl Data<Elem = F>, Ix1>, xtrain: &ArrayBase<impl Data<Elem = F>, Ix2>, theta: &ArrayBase<impl Data<Elem = F>, Ix1>, weights: &ArrayBase<impl Data<Elem = F>, Ix2>, ) -> Array2<F>

Compute gradients of r(x, x') at given x given a set of x' training samples, aka xtrain, theta parameters, and PLS weights. The returned jacobian matrix is dr/dx where r is the correlation function vector between x and xtrain (shape nt). Gradients are computed with respect to x and returned as a matrix of shape (nt, nx) where nt is the number of training samples (aka xtrain.nrows()) and nx is the dimension of x.

Source

fn rval_with_jac( &self, x: &ArrayBase<impl Data<Elem = F>, Ix1>, xtrain: &ArrayBase<impl Data<Elem = F>, Ix2>, theta: &ArrayBase<impl Data<Elem = F>, Ix1>, weights: &ArrayBase<impl Data<Elem = F>, Ix2>, ) -> (Array2<F>, Array2<F>)

Compute both the correlation function matrix r(x, x') and its jacobian at given x given a set of xtrain training samples, theta parameters, and PLS weights. Used to avoid redundant computations when both correlation and jacobian are needed.

Provided Methods§

Source

fn rval( &self, x: &ArrayBase<impl Data<Elem = F>, Ix1>, xtrain: &ArrayBase<impl Data<Elem = F>, Ix2>, theta: &ArrayBase<impl Data<Elem = F>, Ix1>, weights: &ArrayBase<impl Data<Elem = F>, Ix2>, ) -> Array2<F>

Compute correlation function r(x, x’) given x and a set of x' training samples, aka xtrain theta parameters, and PLS weights with:

  • x : point at which to compute correlation (shape nx)
  • xtrain : training samples (shape nt x nx) where nx is the dimension of x and nt is the number of training samples (aka xtrain.nrows()).
  • theta : hyperparameters (shape 1 x nx)
  • weights : PLS weights (shape nx x h) where h is the reduced dimension when PLS is used (kpls_dim).

The returned correlation function matrix has shape (nt x 1) and corresponds to r(x, xtrain) where r is the correlation function defined by the model.

Source

fn theta_influence_factors(&self) -> (F, F)

Returns the theta influence factors for the correlation model. See https://hal.science/hal-03812073v2/document

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§