pub struct ElasticNetParamsBase<F, const MULTI_TASK: bool>(/* private fields */);
Implementations§
Source§impl<F: Float, const MULTI_TASK: bool> ElasticNetParamsBase<F, MULTI_TASK>
Configure and fit a Elastic Net model
impl<F: Float, const MULTI_TASK: bool> ElasticNetParamsBase<F, MULTI_TASK>
Configure and fit a Elastic Net model
Sourcepub fn new() -> ElasticNetParamsBase<F, MULTI_TASK>
pub fn new() -> ElasticNetParamsBase<F, MULTI_TASK>
Create default elastic net hyper parameters
By default, an intercept will be fitted. To disable fitting an
intercept, call .with_intercept(false)
before calling .fit()
.
To additionally normalize the feature matrix before fitting, call
fit_intercept_and_normalize()
before calling fit()
. The feature
matrix will not be normalized by default.
Sourcepub fn penalty(self, penalty: F) -> Self
pub fn penalty(self, penalty: F) -> Self
Set the overall parameter penalty parameter of the elastic net, otherwise known as alpha
.
Use l1_ratio
to configure how the penalty distributed to L1 and L2
regularization.
Sourcepub fn l1_ratio(self, l1_ratio: F) -> Self
pub fn l1_ratio(self, l1_ratio: F) -> Self
Set l1_ratio parameter of the elastic net. Controls how the parameter
penalty is distributed to L1 and L2 regularization.
Setting l1_ratio
to 1.0 is equivalent to a “Lasso” penalization,
setting it to 0.0 is equivalent to “Ridge” penalization.
Defaults to 0.5
if not set
l1_ratio
must be between 0.0
and 1.0
.
Sourcepub fn with_intercept(self, with_intercept: bool) -> Self
pub fn with_intercept(self, with_intercept: bool) -> Self
Configure the elastic net model to fit an intercept.
Defaults to true
if not set.
Sourcepub fn tolerance(self, tolerance: F) -> Self
pub fn tolerance(self, tolerance: F) -> Self
Set the tolerance which is the minimum absolute change in any of the model parameters needed for the parameter optimization to continue.
Defaults to 1e-4
if not set
Sourcepub fn max_iterations(self, max_iterations: u32) -> Self
pub fn max_iterations(self, max_iterations: u32) -> Self
Set the maximum number of iterations for the optimization routine.
Defaults to 1000
if not set
Trait Implementations§
Source§impl<F: Clone, const MULTI_TASK: bool> Clone for ElasticNetParamsBase<F, MULTI_TASK>
impl<F: Clone, const MULTI_TASK: bool> Clone for ElasticNetParamsBase<F, MULTI_TASK>
Source§fn clone(&self) -> ElasticNetParamsBase<F, MULTI_TASK>
fn clone(&self) -> ElasticNetParamsBase<F, MULTI_TASK>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<F: Float, const MULTI_TASK: bool> Default for ElasticNetParamsBase<F, MULTI_TASK>
impl<F: Float, const MULTI_TASK: bool> Default for ElasticNetParamsBase<F, MULTI_TASK>
Source§impl<F: Float, const MULTI_TASK: bool> ParamGuard for ElasticNetParamsBase<F, MULTI_TASK>
impl<F: Float, const MULTI_TASK: bool> ParamGuard for ElasticNetParamsBase<F, MULTI_TASK>
Source§type Checked = ElasticNetValidParamsBase<F, MULTI_TASK>
type Checked = ElasticNetValidParamsBase<F, MULTI_TASK>
Source§type Error = ElasticNetError
type Error = ElasticNetError
Source§fn check(self) -> Result<Self::Checked>
fn check(self) -> Result<Self::Checked>
§fn check_unwrap(self) -> Self::Checkedwhere
Self: Sized,
fn check_unwrap(self) -> Self::Checkedwhere
Self: Sized,
check()
and unwraps the resultSource§impl<F: PartialEq, const MULTI_TASK: bool> PartialEq for ElasticNetParamsBase<F, MULTI_TASK>
impl<F: PartialEq, const MULTI_TASK: bool> PartialEq for ElasticNetParamsBase<F, MULTI_TASK>
Source§fn eq(&self, other: &ElasticNetParamsBase<F, MULTI_TASK>) -> bool
fn eq(&self, other: &ElasticNetParamsBase<F, MULTI_TASK>) -> bool
self
and other
values to be equal, and is used by ==
.impl<F: Eq, const MULTI_TASK: bool> Eq for ElasticNetParamsBase<F, MULTI_TASK>
impl<F, const MULTI_TASK: bool> StructuralPartialEq for ElasticNetParamsBase<F, MULTI_TASK>
Auto Trait Implementations§
impl<F, const MULTI_TASK: bool> Freeze for ElasticNetParamsBase<F, MULTI_TASK>where
F: Freeze,
impl<F, const MULTI_TASK: bool> RefUnwindSafe for ElasticNetParamsBase<F, MULTI_TASK>where
F: RefUnwindSafe,
impl<F, const MULTI_TASK: bool> Send for ElasticNetParamsBase<F, MULTI_TASK>where
F: Send,
impl<F, const MULTI_TASK: bool> Sync for ElasticNetParamsBase<F, MULTI_TASK>where
F: Sync,
impl<F, const MULTI_TASK: bool> Unpin for ElasticNetParamsBase<F, MULTI_TASK>where
F: Unpin,
impl<F, const MULTI_TASK: bool> UnwindSafe for ElasticNetParamsBase<F, MULTI_TASK>where
F: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.