Struct rusty_machine::learning::logistic_reg::LogisticRegressor [] [src]

pub struct LogisticRegressor {
    // some fields omitted
}

Logistic Regression Model.

Contains option for optimized parameter.

Methods

impl LogisticRegressor
[src]

fn new(gd: GradientDesc) -> LogisticRegressor

Constructs untrained logistic regression model.

Examples

use rusty_machine::learning::logistic_reg::LogisticRegressor;
use rusty_machine::learning::optim::grad_desc::GradientDesc;

let gd = GradientDesc::default();
let mut logistic_mod = LogisticRegressor::new(gd);

fn parameters(&self) -> Option<Vector<f64>>

Get the parameters from the model.

Returns an option that is None if the model has not been trained.

Trait Implementations

impl Default for LogisticRegressor
[src]

fn default() -> LogisticRegressor

Returns the "default value" for a type. Read more

impl SupModel<Matrix<f64>, Vector<f64>> for LogisticRegressor
[src]

fn train(&mut self, inputs: &Matrix<f64>, targets: &Vector<f64>)

Train the logistic regression model.

Takes training data and output values as input.

Examples

use rusty_machine::learning::logistic_reg::LogisticRegressor;
use rusty_machine::linalg::matrix::Matrix;
use rusty_machine::linalg::vector::Vector;
use rusty_machine::learning::SupModel;

let mut logistic_mod = LogisticRegressor::default();
let inputs = Matrix::new(3,2, vec![1.0, 2.0, 1.0, 3.0, 1.0, 4.0]);
let targets = Vector::new(vec![5.0, 6.0, 7.0]);

logistic_mod.train(&inputs, &targets);

fn predict(&self, inputs: &Matrix<f64>) -> Vector<f64>

Predict output value from input data.

Model must be trained before prediction can be made.

impl Optimizable for LogisticRegressor
[src]

type Inputs = Matrix<f64>

The input data type to the model.

type Targets = Vector<f64>

The target data type to the model.

fn compute_grad(&self, params: &[f64], inputs: &Matrix<f64>, targets: &Vector<f64>) -> (f64, Vec<f64>)

Compute the gradient for the model.