pub struct SvmParams<F: Float, T>(/* private fields */);
Implementations§
Source§impl<F: Float, T> SvmParams<F, T>
impl<F: Float, T> SvmParams<F, T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create hyper parameter set
This creates a SvmParams
and sets it to the default values:
- C values of (1, 1)
- Eps of 1e-7
- No shrinking
- Linear kernel
Sourcepub fn eps(self, new_eps: F) -> Self
pub fn eps(self, new_eps: F) -> Self
Set stopping condition
This parameter controls the stopping condition. It checks whether the sum of gradients of the max violating pair is below this threshold and then stops the optimization proces.
Sourcepub fn shrinking(self, shrinking: bool) -> Self
pub fn shrinking(self, shrinking: bool) -> Self
Shrink active variable set
This parameter controls whether the active variable set is shrinked or not. This can speed up the optimization process, but may degredade the solution performance.
Sourcepub fn with_kernel_params(self, kernel: KernelParams<F>) -> Self
pub fn with_kernel_params(self, kernel: KernelParams<F>) -> Self
Set the kernel to use for training
This parameter specifies a mapping of input records to a new feature space by means
of the distance function between any couple of points mapped to such new space.
The SVM then applies a linear separation in the new feature space that may result in
a non linear partitioning of the original input space, thus increasing the expressiveness of
this model. To use the “base” SVM model it suffices to choose a Linear
kernel.
Sourcepub fn with_platt_params(self, platt: PlattParams<F, ()>) -> Self
pub fn with_platt_params(self, platt: PlattParams<F, ()>) -> Self
Set the platt params for probability calibration
Sourcepub fn gaussian_kernel(self, eps: F) -> Self
pub fn gaussian_kernel(self, eps: F) -> Self
Sets the model to use the Gaussian kernel. For this kernel the
distance between two points is computed as: d(x, x') = exp(-norm(x - x')/eps)
Sourcepub fn polynomial_kernel(self, constant: F, degree: F) -> Self
pub fn polynomial_kernel(self, constant: F, degree: F) -> Self
Sets the model to use the Polynomial kernel. For this kernel the
distance between two points is computed as: d(x, x') = (<x, x'> + constant)^(degree)
Sourcepub fn linear_kernel(self) -> Self
pub fn linear_kernel(self) -> Self
Sets the model to use the Linear kernel. For this kernel the
distance between two points is computed as : d(x, x') = <x, x'>
Source§impl<F: Float, T> SvmParams<F, T>
impl<F: Float, T> SvmParams<F, T>
Sourcepub fn pos_neg_weights(self, c_pos: F, c_neg: F) -> Self
pub fn pos_neg_weights(self, c_pos: F, c_neg: F) -> Self
Set the C value for positive and negative samples.
Source§impl<F: Float> SvmParams<F, F>
impl<F: Float> SvmParams<F, F>
Sourcepub fn c_eps(self, c: F, eps: F) -> Self
👎Deprecated since 0.7.2: Use .c_svr() and .eps()
pub fn c_eps(self, c: F, eps: F) -> Self
Set the C value for regression and solver epsilon stopping condition. Loss epsilon value is fixed at 0.1.
Sourcepub fn nu_eps(self, nu: F, eps: F) -> Self
👎Deprecated since 0.7.2: Use .nu_svr() and .eps()
pub fn nu_eps(self, nu: F, eps: F) -> Self
Set the Nu value for regression and solver epsilon stopping condition. C value used value is fixed at 1.0.
Trait Implementations§
Source§impl<F: Float, L> ParamGuard for SvmParams<F, L>
impl<F: Float, L> ParamGuard for SvmParams<F, L>
Source§type Checked = SvmValidParams<F, L>
type Checked = SvmValidParams<F, L>
Source§fn check_ref(&self) -> Result<&Self::Checked, Self::Error>
fn check_ref(&self) -> Result<&Self::Checked, Self::Error>
Source§fn check(self) -> Result<Self::Checked, Self::Error>
fn check(self) -> Result<Self::Checked, Self::Error>
Source§fn check_unwrap(self) -> Self::Checkedwhere
Self: Sized,
fn check_unwrap(self) -> Self::Checkedwhere
Self: Sized,
check()
and unwraps the resultimpl<F: Float, T> StructuralPartialEq for SvmParams<F, T>
Auto Trait Implementations§
impl<F, T> Freeze for SvmParams<F, T>where
F: Freeze,
impl<F, T> RefUnwindSafe for SvmParams<F, T>where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<F, T> Send for SvmParams<F, T>where
T: Send,
impl<F, T> Sync for SvmParams<F, T>where
T: Sync,
impl<F, T> Unpin for SvmParams<F, T>where
T: Unpin,
impl<F, T> UnwindSafe for SvmParams<F, T>where
F: UnwindSafe,
T: 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<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