pub struct KernelSVMTrainer {
pub n: usize,
pub alphas: Vec<f64>,
pub labels: Vec<f64>,
pub bias: f64,
pub c: f64,
}Expand description
Kernel SVM trainer using a simplified SMO algorithm.
Implements the Sequential Minimal Optimization (SMO) core update step.
Fields§
§n: usizeNumber of training points.
alphas: Vec<f64>Dual variables α_i ∈ [0, C].
labels: Vec<f64>Labels y_i ∈ {-1, +1}.
bias: f64Bias term b.
c: f64Regularization parameter C (upper bound on α_i).
Implementations§
Source§impl KernelSVMTrainer
impl KernelSVMTrainer
Sourcepub fn new(n: usize, labels: Vec<f64>, c: f64) -> Self
pub fn new(n: usize, labels: Vec<f64>, c: f64) -> Self
Create a new KernelSVMTrainer with zero alphas.
Sourcepub fn decision(&self, kernel_row: &[f64]) -> f64
pub fn decision(&self, kernel_row: &[f64]) -> f64
Compute the SVM decision function f(x) = Σ α_i y_i k(x_i, x) + b.
Auto Trait Implementations§
impl Freeze for KernelSVMTrainer
impl RefUnwindSafe for KernelSVMTrainer
impl Send for KernelSVMTrainer
impl Sync for KernelSVMTrainer
impl Unpin for KernelSVMTrainer
impl UnsafeUnpin for KernelSVMTrainer
impl UnwindSafe for KernelSVMTrainer
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