pub struct FittedElasticNet<F> { /* private fields */ }Expand description
Fitted ElasticNet regression model.
Stores the learned (potentially sparse) coefficients and intercept.
Implements Predict and HasCoefficients.
Implementations§
Source§impl<F: Float> FittedElasticNet<F>
impl<F: Float> FittedElasticNet<F>
Sourcepub fn n_iter(&self) -> usize
pub fn n_iter(&self) -> usize
Number of coordinate-descent sweeps run by the solver.
Mirrors sklearn’s ElasticNet.n_iter_ attribute
(_coordinate_descent.py:827). ferrolearn uses sklearn’s relative-change
and dual-gap stopping criterion (REQ-13, _cd_fast.pyx:167-249), so this
1-based count matches sklearn’s n_iter_ value exactly at the same
optimum.
Trait Implementations§
Source§impl<F: Clone> Clone for FittedElasticNet<F>
impl<F: Clone> Clone for FittedElasticNet<F>
Source§fn clone(&self) -> FittedElasticNet<F>
fn clone(&self) -> FittedElasticNet<F>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<F: Debug> Debug for FittedElasticNet<F>
impl<F: Debug> Debug for FittedElasticNet<F>
Source§impl<F> FittedPipelineEstimator<F> for FittedElasticNet<F>
impl<F> FittedPipelineEstimator<F> for FittedElasticNet<F>
Source§fn predict_pipeline(&self, x: &Array2<F>) -> Result<Array1<F>, FerroError>
fn predict_pipeline(&self, x: &Array2<F>) -> Result<Array1<F>, FerroError>
Source§fn predict_proba_pipeline(
&self,
x: &ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>,
) -> Result<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, FerroError>
fn predict_proba_pipeline( &self, x: &ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ) -> Result<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, FerroError>
Class-probability estimates for the input data, shape
(n_samples, n_classes). Read moreSource§fn decision_function_pipeline(
&self,
x: &ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>,
) -> Result<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, FerroError>
fn decision_function_pipeline( &self, x: &ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ) -> Result<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, FerroError>
Confidence scores (decision function) for the input data, shape
(n_samples, n_classes) (or (n_samples,) for binary, per the
estimator’s contract). Read moreSource§impl<F: Float + Send + Sync + ScalarOperand + 'static> HasCoefficients<F> for FittedElasticNet<F>
impl<F: Float + Send + Sync + ScalarOperand + 'static> HasCoefficients<F> for FittedElasticNet<F>
Source§impl<F: Float + Send + Sync + ScalarOperand + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedElasticNet<F>
impl<F: Float + Send + Sync + ScalarOperand + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedElasticNet<F>
Source§fn predict(&self, x: &Array2<F>) -> Result<Array1<F>, FerroError>
fn predict(&self, x: &Array2<F>) -> Result<Array1<F>, FerroError>
Predict target values for the given feature matrix.
Computes X @ coefficients + intercept.
§Errors
Returns FerroError::ShapeMismatch if the number of features
does not match the fitted model.
Source§type Output = ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>
type Output = ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>
The prediction output type (e.g.,
ndarray::Array1<F> or ndarray::Array1<usize>).Source§type Error = FerroError
type Error = FerroError
The error type returned by
predict.Auto Trait Implementations§
impl<F> Freeze for FittedElasticNet<F>where
F: Freeze,
impl<F> RefUnwindSafe for FittedElasticNet<F>where
F: RefUnwindSafe,
impl<F> Send for FittedElasticNet<F>where
F: Send,
impl<F> Sync for FittedElasticNet<F>where
F: Sync,
impl<F> Unpin for FittedElasticNet<F>where
F: Unpin,
impl<F> UnsafeUnpin for FittedElasticNet<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for FittedElasticNet<F>where
F: UnwindSafe + RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T, F> RegressorScore<F> for T
impl<T, F> RegressorScore<F> for T
Source§fn score(
&self,
x: &ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>,
y: &ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>,
sample_weight: Option<&ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>>,
) -> Result<F, FerroError>
fn score( &self, x: &ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, y: &ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>, sample_weight: Option<&ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>>, ) -> Result<F, FerroError>
(Optionally weighted) R² coefficient of determination on the given test
data and targets. Read more