pub struct SVR<F, K> {
pub kernel: K,
pub c: F,
pub epsilon: F,
pub tol: F,
pub max_iter: usize,
pub cache_size: usize,
}Expand description
Support Vector Regressor.
Uses SMO to solve the epsilon-SVR dual problem.
§Type Parameters
F: The floating-point type (f32orf64).K: The kernel type.
Fields§
§kernel: KThe kernel function.
c: FRegularization parameter.
epsilon: FEpsilon tube width (insensitive loss zone).
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>> SVR<F, K>
impl<F: Float, K: Kernel<F>> SVR<F, K>
Sourcepub fn new(kernel: K) -> Self
pub fn new(kernel: K) -> Self
Create a new SVR with the given kernel and default hyperparameters.
Defaults: C = 1.0, epsilon = 0.1, tol = 1e-3,
max_iter = 10000, cache_size = 1024.
Sourcepub fn with_epsilon(self, epsilon: F) -> Self
pub fn with_epsilon(self, epsilon: F) -> Self
Set the epsilon tube width.
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<F>, Dim<[usize; 1]>>> for SVR<F, K>
impl<F: Float + Send + Sync + ScalarOperand + 'static, K: Kernel<F> + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>> for SVR<F, K>
Source§fn fit(
&self,
x: &Array2<F>,
y: &Array1<F>,
) -> Result<FittedSVR<F, K>, FerroError>
fn fit( &self, x: &Array2<F>, y: &Array1<F>, ) -> Result<FittedSVR<F, K>, FerroError>
Fit the SVR model using SMO.
§Errors
Returns FerroError::ShapeMismatch if x and y have different
sample counts.
Returns FerroError::InvalidParameter if C is not positive.
Source§type Error = FerroError
type Error = FerroError
The error type returned by
fit.Auto Trait Implementations§
impl<F, K> Freeze for SVR<F, K>
impl<F, K> RefUnwindSafe for SVR<F, K>where
K: RefUnwindSafe,
F: RefUnwindSafe,
impl<F, K> Send for SVR<F, K>
impl<F, K> Sync for SVR<F, K>
impl<F, K> Unpin for SVR<F, K>
impl<F, K> UnsafeUnpin for SVR<F, K>where
K: UnsafeUnpin,
F: UnsafeUnpin,
impl<F, K> UnwindSafe for SVR<F, K>where
K: UnwindSafe,
F: 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