pub struct OneClassSVM<F, K> {
pub nu: F,
pub kernel: K,
pub tol: F,
pub max_iter: usize,
pub cache_size: usize,
}Expand description
Fields§
§nu: FThe nu parameter: upper bound on the fraction of outliers.
Must be in (0, 1]. Default: 0.5.
kernel: KThe kernel function.
tol: FConvergence tolerance.
max_iter: usizeMaximum number of SMO iterations.
cache_size: usizeSize of the kernel evaluation LRU cache.
Implementations§
Source§impl<F: Float, K: Kernel<F>> OneClassSVM<F, K>
impl<F: Float, K: Kernel<F>> OneClassSVM<F, K>
Sourcepub fn new(kernel: K) -> Self
pub fn new(kernel: K) -> Self
Create a new OneClassSVM with the given kernel and default hyperparameters.
Defaults: nu = 0.5, tol = 1e-3, max_iter = 10000, cache_size = 1024.
Sourcepub fn with_max_iter(self, max_iter: usize) -> Self
pub fn with_max_iter(self, max_iter: usize) -> Self
Set the maximum number of SMO iterations.
Sourcepub fn with_cache_size(self, cache_size: usize) -> Self
pub fn with_cache_size(self, cache_size: usize) -> Self
Set the kernel cache size.
Trait Implementations§
Source§impl<F: Clone, K: Clone> Clone for OneClassSVM<F, K>
impl<F: Clone, K: Clone> Clone for OneClassSVM<F, K>
Source§fn clone(&self) -> OneClassSVM<F, K>
fn clone(&self) -> OneClassSVM<F, K>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<F: Float + Send + Sync + ScalarOperand + 'static, K: Kernel<F> + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ()> for OneClassSVM<F, K>
impl<F: Float + Send + Sync + ScalarOperand + 'static, K: Kernel<F> + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ()> for OneClassSVM<F, K>
Source§fn fit(
&self,
x: &Array2<F>,
_y: &(),
) -> Result<FittedOneClassSVM<F, K>, FerroError>
fn fit( &self, x: &Array2<F>, _y: &(), ) -> Result<FittedOneClassSVM<F, K>, FerroError>
Fit the One-Class SVM.
§Errors
FerroError::InvalidParameterifnuis not in(0, 1].FerroError::InsufficientSamplesif no training data is provided.
Source§type Fitted = FittedOneClassSVM<F, K>
type Fitted = FittedOneClassSVM<F, K>
The fitted model type returned by
fit.Source§type Error = FerroError
type Error = FerroError
The error type returned by
fit.Auto Trait Implementations§
impl<F, K> Freeze for OneClassSVM<F, K>
impl<F, K> RefUnwindSafe for OneClassSVM<F, K>where
F: RefUnwindSafe,
K: RefUnwindSafe,
impl<F, K> Send for OneClassSVM<F, K>
impl<F, K> Sync for OneClassSVM<F, K>
impl<F, K> Unpin for OneClassSVM<F, K>
impl<F, K> UnsafeUnpin for OneClassSVM<F, K>where
F: UnsafeUnpin,
K: UnsafeUnpin,
impl<F, K> UnwindSafe for OneClassSVM<F, K>where
F: UnwindSafe,
K: 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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>
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 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>
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