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'> + costant)^(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

Set the C value for regression

source

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

Set the Nu-Eps value 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>

§

type Checked = SvmValidParams<F, L>

The checked hyperparameters
§

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::Checkedwhere 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

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

§

fn vzip(self) -> V