[][src]Trait friedrich::Input

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> { ... } }

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 -> ouput pairs :

  • Vec<Vec<f64>> -> Vec<f64> each inner vector is a multidimentional training sample
  • Vec<f64> -> f64 a single multidimensional sample
  • DMatrix<f64> -> DVector<f64> using a nalgebra matrix with one row per sample

User-defined input type should implement this trait.

Associated Types

type InVector: Sized

type of the vectors storing training output data and given to methods

type OutVector

type of the vectors outputed when a method is called

Loading content...

Required methods

fn to_dmatrix(m: &Self) -> DMatrix<f64>

Converts an input matrix to a DMatrix.

fn to_dvector(v: &Self::InVector) -> DVector<f64>

Converts an input vector to a DVector.

fn from_dvector(v: &DVector<f64>) -> Self::OutVector

converts a DVector to an output vector.

Loading content...

Provided methods

fn into_dmatrix(m: Self) -> DMatrix<f64>

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.

fn into_dvector(v: Self::InVector) -> DVector<f64>

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.

Loading content...

Implementations on Foreign Types

impl Input for DMatrix<f64>[src]

direct implementation

type InVector = DVector<f64>

type OutVector = DVector<f64>

fn to_dmatrix(m: &Self) -> DMatrix<f64>[src]

converts an input matrix to a DMatrix

fn to_dvector(v: &Self::InVector) -> DVector<f64>[src]

converts an input vector to a DVector

fn into_dmatrix(m: Self) -> DMatrix<f64>[src]

converts an input matrix to a DMatrix

fn into_dvector(v: Self::InVector) -> DVector<f64>[src]

converts an input vector to a DVector

fn from_dvector(v: &DVector<f64>) -> Self::OutVector[src]

converts a DVector to an output vector

impl Input for Vec<f64>[src]

single row

type InVector = f64

type OutVector = f64

fn to_dmatrix(m: &Self) -> DMatrix<f64>[src]

converts an input matrix to a DMatrix

fn to_dvector(v: &Self::InVector) -> DVector<f64>[src]

converts an input vector to a DVector

fn from_dvector(v: &DVector<f64>) -> Self::OutVector[src]

converts a DVector to an output vector

impl Input for Vec<Vec<f64>>[src]

multiple rows, base rust type

type InVector = Vec<f64>

type OutVector = Vec<f64>

fn to_dmatrix(m: &Self) -> DMatrix<f64>[src]

converts an input matrix to a DMatrix

fn to_dvector(v: &Self::InVector) -> DVector<f64>[src]

converts an input vector to a DVector

fn from_dvector(v: &DVector<f64>) -> Self::OutVector[src]

converts a DVector to an output vector

Loading content...

Implementors

Loading content...