[][src]Trait tinguely::model::SupervisedLearn

pub trait SupervisedLearn<T, U> {
    fn predict(&self, input: &T) -> U;
fn train(&mut self, input: &T, target: &U); }

Required methods

fn predict(&self, input: &T) -> U

Predict output from inputs.

fn train(&mut self, input: &T, target: &U)

Train the model using inputs and targets.

Loading content...

Implementors

impl SupervisedLearn<Matrix<f64>, Vector<f64>> for SVM[src]

fn predict(&self, input: &Matrix<f64>) -> Vector<f64>[src]

Predict output from inputs.

fn train(&mut self, input: &Matrix<f64>, target: &Vector<f64>)[src]

Train the model using inputs and targets.

impl<O> SupervisedLearn<Matrix<f64>, Vector<f64>> for LogisticRegression<O> where
    O: OptimAlgorithm<LogisticRegressionBase>, 
[src]

impl<O> SupervisedLearn<Matrix<f64>, Vector<f64>> for LinearRegression<O> where
    O: OptimAlgorithm<LinearRegressionBase>, 
[src]

fn train<'a, 'b>(&'a mut self, x: &'b Matrix<f64>, y: &'b Vector<f64>)[src]

Train the linear regression model.

Examples

use tinguely::regression::LinearRegression;
use mathru::algebra::linear::{Vector, Matrix};
use mathru::optim::StochasticGradientDesc;
use tinguely::SupervisedLearn;

let optimizer = StochasticGradientDesc::new(0.01, 0.0, 100);
let mut lin_mod = LinearRegression::new(optimizer);
let inputs = Matrix::new(3, 1, vec![2.0, 3.0, 4.0]);
let targets = Vector::new_column(3, vec![5.0, 6.0, 7.0]);

lin_mod.train(&inputs, &targets);
Loading content...