pub struct LogisticRegressor<A>where
A: OptimAlgorithm<BaseLogisticRegressor>,{ /* private fields */ }Expand description
Logistic Regression Model.
Contains option for optimized parameter.
Implementations§
Source§impl<A: OptimAlgorithm<BaseLogisticRegressor>> LogisticRegressor<A>
impl<A: OptimAlgorithm<BaseLogisticRegressor>> LogisticRegressor<A>
Sourcepub fn new(alg: A) -> LogisticRegressor<A>
pub fn new(alg: A) -> LogisticRegressor<A>
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);Sourcepub fn parameters(&self) -> Option<&Vector<f64>>
pub 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§
Source§impl<A> Debug for LogisticRegressor<A>
impl<A> Debug for LogisticRegressor<A>
Source§impl Default for LogisticRegressor<GradientDesc>
Constructs a default Logistic Regression model
using standard gradient descent.
impl Default for LogisticRegressor<GradientDesc>
Constructs a default Logistic Regression model using standard gradient descent.
Source§fn default() -> LogisticRegressor<GradientDesc>
fn default() -> LogisticRegressor<GradientDesc>
Returns the “default value” for a type. Read more
Source§impl<A> SupModel<Matrix<f64>, Vector<f64>> for LogisticRegressor<A>where
A: OptimAlgorithm<BaseLogisticRegressor>,
impl<A> SupModel<Matrix<f64>, Vector<f64>> for LogisticRegressor<A>where
A: OptimAlgorithm<BaseLogisticRegressor>,
Source§fn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>,
) -> LearningResult<()>
fn train( &mut self, inputs: &Matrix<f64>, targets: &Vector<f64>, ) -> LearningResult<()>
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;
use rusty_machine::linalg::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).unwrap();Auto Trait Implementations§
impl<A> Freeze for LogisticRegressor<A>where
A: Freeze,
impl<A> RefUnwindSafe for LogisticRegressor<A>where
A: RefUnwindSafe,
impl<A> Send for LogisticRegressor<A>where
A: Send,
impl<A> Sync for LogisticRegressor<A>where
A: Sync,
impl<A> Unpin for LogisticRegressor<A>where
A: Unpin,
impl<A> UnwindSafe for LogisticRegressor<A>where
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more