pub struct LogisticRegressionCV { /* private fields */ }Expand description
L2-penalised logistic regression with C chosen by stratified K-fold
cross-validation, as scikit-learn’s LogisticRegressionCV.
The candidates are n_cs values of C evenly spaced on a log scale
between 1e-4 and 1e4 (or given explicitly). Each is fitted on every
fold (warm-started along the path), the C with the best total score is
chosen and the model is refitted on all the data. Folds follow
scikit-learn’s StratifiedKFold without shuffling.
Implementations§
Source§impl LogisticRegressionCV
impl LogisticRegressionCV
Sourcepub fn n_cs(self, n: usize) -> Self
pub fn n_cs(self, n: usize) -> Self
n values of C evenly spaced on a log scale from 1e-4 to 1e4.
Sourcepub fn cs(self, cs: Vec<f64>) -> Self
pub fn cs(self, cs: Vec<f64>) -> Self
Explicit candidate values of C, tried in the given order.
pub fn cv(self, cv: usize) -> Self
pub fn scoring(self, scoring: CvScoring) -> Self
Sourcepub fn tol(self, tol: f64) -> Self
pub fn tol(self, tol: f64) -> Self
Newton tolerance, as LogisticRegression::tol.
pub fn max_iter(self, max_iter: usize) -> Self
Sourcepub fn scores(&self) -> Option<&Array2<f64>>
pub fn scores(&self) -> Option<&Array2<f64>>
Score of every C on every fold (higher is better; the log loss enters
negated), shape (cv, n_cs).
pub fn coef(&self) -> Option<&Array1<f64>>
pub fn intercept(&self) -> f64
Trait Implementations§
Source§impl Classifier for LogisticRegressionCV
impl Classifier for LogisticRegressionCV
fn fit(&mut self, x: ArrayView2<'_, f64>, y: ArrayView1<'_, f64>) -> Result<()>
fn predict_proba(&self, x: ArrayView2<'_, f64>) -> Result<Array1<f64>>
fn fresh(&self) -> Box<dyn Classifier>
Source§fn fit_weighted(
&mut self,
_x: ArrayView2<'_, f64>,
_y: ArrayView1<'_, f64>,
_w: ArrayView1<'_, f64>,
) -> Result<()>
fn fit_weighted( &mut self, _x: ArrayView2<'_, f64>, _y: ArrayView1<'_, f64>, _w: ArrayView1<'_, f64>, ) -> Result<()>
Fit minimising a
w-weighted loss (needed by Lplr’s
instrument score). The default reports that weights are unsupported.Source§impl Clone for LogisticRegressionCV
impl Clone for LogisticRegressionCV
Source§impl Debug for LogisticRegressionCV
impl Debug for LogisticRegressionCV
Auto Trait Implementations§
impl Freeze for LogisticRegressionCV
impl RefUnwindSafe for LogisticRegressionCV
impl Send for LogisticRegressionCV
impl Sync for LogisticRegressionCV
impl Unpin for LogisticRegressionCV
impl UnsafeUnpin for LogisticRegressionCV
impl UnwindSafe for LogisticRegressionCV
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more