Trait rustml::regression::DesignMatrix [] [src]

pub trait DesignMatrix<T> {
    fn design_matrix(&self) -> Self;
}

Trait to create the design matrix of a matrix of features, i.e. a new column is inserted at the left of the matrix where all elements are equal to one.

use rustml::*;
use rustml::regression::DesignMatrix;

let m = mat![
    2.0, 3.0, 4.0;
    5.0, 6.0, 7.0
];
let d = m.design_matrix();
assert!(
    d.eq(
        &mat![
            1.0, 2.0, 3.0, 4.0;
            1.0, 5.0, 6.0, 7.0
        ]
    )
);

Required Methods

fn design_matrix(&self) -> Self

Implementors