Struct SvmParams

Source
pub struct SvmParams<F: Float, T>(/* private fields */);

Implementations§

Source§

impl<F: Float, T> SvmParams<F, T>

Source

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
Source

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.

Source

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.

Source

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.

Source

pub fn with_platt_params(self, platt: PlattParams<F, ()>) -> Self

Set the platt params for probability calibration

Source

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)

Source

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)

Source

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>

Source

pub fn pos_neg_weights(self, c_pos: F, c_neg: F) -> Self

Set the C value for positive and negative samples.

Source

pub fn nu_weight(self, nu: F) -> Self

Set the Nu value for classification

The Nu value should lie in range [0, 1] and sets the relation between support vectors and solution performance.

Source§

impl<F: Float> SvmParams<F, F>

Source

pub fn c_eps(self, c: F, eps: F) -> Self

👎Deprecated since 0.7.2: Use .c_svr() and .eps()

Set the C value for regression and solver epsilon stopping condition. Loss epsilon value is fixed at 0.1.

Source

pub fn nu_eps(self, nu: F, eps: F) -> Self

👎Deprecated since 0.7.2: Use .nu_svr() and .eps()

Set the Nu value for regression and solver epsilon stopping condition. C value used value is fixed at 1.0.

Source

pub fn c_svr(self, c: F, loss_eps: Option<F>) -> Self

Set the C value and optionnaly an epsilon value used in loss function (default 0.1) for regression

Source

pub fn nu_svr(self, nu: F, c: Option<F>) -> Self

Set the Nu and optionally a C value (default 1.) for regression

Trait Implementations§

Source§

impl<F: Clone + Float, T: Clone> Clone for SvmParams<F, T>

Source§

fn clone(&self) -> SvmParams<F, T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Debug + Float, T: Debug> Debug for SvmParams<F, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: Float, L> Default for SvmParams<F, L>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<F: Float, L> ParamGuard for SvmParams<F, L>

Source§

type Checked = SvmValidParams<F, L>

The checked hyperparameters
Source§

type Error = SvmError

Error type resulting from failed hyperparameter checking
Source§

fn check_ref(&self) -> Result<&Self::Checked, Self::Error>

Checks the hyperparameters and returns a reference to the checked hyperparameters if successful
Source§

fn check(self) -> Result<Self::Checked, Self::Error>

Checks the hyperparameters and returns the checked hyperparameters if successful
Source§

fn check_unwrap(self) -> Self::Checked
where Self: Sized,

Calls check() and unwraps the result
Source§

impl<F: PartialEq + Float, T: PartialEq> PartialEq for SvmParams<F, T>

Source§

fn eq(&self, other: &SvmParams<F, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<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>

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V