Trait friedrich::Input

source ·
pub trait Input: Sized {
    type InVector: Sized;
    type OutVector;

    fn to_dmatrix(m: &Self) -> DMatrix<f64>;
    fn to_dvector(v: &Self::InVector) -> DVector<f64>;
    fn from_dvector(v: &DVector<f64>) -> Self::OutVector;

    fn into_dmatrix(m: Self) -> DMatrix<f64> { ... }
    fn into_dvector(v: Self::InVector) -> DVector<f64> { ... }
}
Expand description

Implemented by Input -> Output type pairs

Handles conversion to DMatrix type and stores information on associated output type. Most methods of this library can currently work with the following input -> output pairs :

InputOutputDescription
Vec<f64>f64A single, multidimensional, sample.
Vec<Vec<f64>>Vec<f64>Each inner vector is a training sample.
DMatrix<f64>DVector<f64>Using a nalgebra matrix with one row per sample.
Array1<f64>f64A single sample stored in a ndarray array (using the friedrich_ndarray feature).
Array2<f64>Array1<f64>Each row is a sample (using the friedrich_ndarray feature).

User-defined input type should implement this trait.

Required Associated Types§

Type of the vectors storing training output data and given to methods.

Type of the vectors output when a method is called.

Required Methods§

Converts an input matrix to a DMatrix.

Converts an input vector to a DVector.

Converts a DVector to an output vector.

Provided Methods§

Optional: converts an owned input matrix to a DMatrix. This function is used for to reduce copies when the input type is compatible with DMatrix.

Optional: converts an owned input vector to a DVector. This function is used for to reduce copies when the input type is compatible with DVector.

Implementations on Foreign Types§

Direct implementation.

Converts an input matrix to a DMatrix.

Converts an input vector to a DVector.

Converts an input matrix to a DMatrix.

Converts an input vector to a DVector.

Converts a DVector to an output vector.

Single row.

Converts an input matrix to a DMatrix.

Converts an input vector to a DVector.

Converts a DVector to an output vector.

Multiple rows, base rust type.

Converts an input matrix to a DMatrix.

Converts an input vector to a DVector.

Converts a DVector to an output vector.

Implementors§