Struct linfa_svm::hyperparams::SvmParams
source · [−]pub struct SvmParams<F: Float, T>(_);
Implementations
sourceimpl<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'> + costant)^(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'>
sourceimpl<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.
Trait Implementations
sourceimpl<F: Float, L> ParamGuard for SvmParams<F, L>
impl<F: Float, L> ParamGuard for SvmParams<F, L>
type Checked = SvmValidParams<F, L>
type Checked = SvmValidParams<F, L>
The checked hyperparameters
sourcefn check_ref(&self) -> Result<&Self::Checked, Self::Error>
fn check_ref(&self) -> Result<&Self::Checked, Self::Error>
Checks the hyperparameters and returns a reference to the checked hyperparameters if successful Read more
sourcefn check(self) -> Result<Self::Checked, Self::Error>
fn check(self) -> Result<Self::Checked, Self::Error>
Checks the hyperparameters and returns the checked hyperparameters if successful
sourcefn check_unwrap(self) -> Self::Checked
fn check_unwrap(self) -> Self::Checked
Calls check()
and unwraps the result
impl<F: Float, T> StructuralPartialEq for SvmParams<F, T>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more