pub struct NuSVC<F, K> {
pub nu: F,
pub kernel: K,
pub tol: F,
pub max_iter: usize,
pub cache_size: usize,
}Expand description
Nu-parameterized Support Vector Classifier.
Instead of specifying C directly, the user sets nu in (0, 1].
Internally, C is derived as 1 / (nu * n_samples).
§Type Parameters
F: The floating-point type (f32orf64).K: The kernel type (e.g.,LinearKernel).
Fields§
§nu: FThe nu parameter, 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>> NuSVC<F, K>
impl<F: Float, K: Kernel<F>> NuSVC<F, K>
Sourcepub fn new(kernel: K) -> Self
pub fn new(kernel: K) -> Self
Create a new NuSVC 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: Float + Send + Sync + ScalarOperand + 'static, K: Kernel<F> + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>> for NuSVC<F, K>
impl<F: Float + Send + Sync + ScalarOperand + 'static, K: Kernel<F> + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>> for NuSVC<F, K>
Source§fn fit(
&self,
x: &Array2<F>,
y: &Array1<usize>,
) -> Result<FittedNuSVC<F, K>, FerroError>
fn fit( &self, x: &Array2<F>, y: &Array1<usize>, ) -> Result<FittedNuSVC<F, K>, FerroError>
Fit the NuSVC model by converting nu to C and delegating to SVC.
§Errors
FerroError::InvalidParameterifnuis not in(0, 1].- All errors from
SVC::fit.
Source§type Fitted = FittedNuSVC<F, K>
type Fitted = FittedNuSVC<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 NuSVC<F, K>
impl<F, K> RefUnwindSafe for NuSVC<F, K>where
F: RefUnwindSafe,
K: RefUnwindSafe,
impl<F, K> Send for NuSVC<F, K>
impl<F, K> Sync for NuSVC<F, K>
impl<F, K> Unpin for NuSVC<F, K>
impl<F, K> UnsafeUnpin for NuSVC<F, K>where
F: UnsafeUnpin,
K: UnsafeUnpin,
impl<F, K> UnwindSafe for NuSVC<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