pub struct SVM<K: Kernel> {
pub optim_iters: usize,
/* private fields */
}
Expand description
Support Vector Machine
Fields
optim_iters: usize
Number of iterations for training.
Implementations
sourceimpl<K: Kernel> SVM<K>
impl<K: Kernel> SVM<K>
sourcepub fn new(ker: K, lambda: f64) -> SVM<K>
pub fn new(ker: K, lambda: f64) -> SVM<K>
Constructs an untrained SVM with specified kernel and lambda which determins the hardness of the margin.
Examples
use rusty_machine::learning::svm::SVM;
use rusty_machine::learning::toolkit::kernel::SquaredExp;
let _ = SVM::new(SquaredExp::default(), 0.3);
Trait Implementations
sourceimpl Default for SVM<SquaredExp>
impl Default for SVM<SquaredExp>
The default Support Vector Machine.
The defaults are:
ker
=SquaredExp::default()
lambda
=0.3
optim_iters
=100
sourcefn default() -> SVM<SquaredExp>
fn default() -> SVM<SquaredExp>
Returns the “default value” for a type. Read more
sourceimpl<K: Kernel> SupModel<Matrix<f64>, Vector<f64>> for SVM<K>
impl<K: Kernel> SupModel<Matrix<f64>, Vector<f64>> for SVM<K>
Train the model using the Pegasos algorithm and predict the model output from new data.
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
Predict output from inputs.
sourcefn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
fn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
Train the model using inputs and targets.
Auto Trait Implementations
impl<K> RefUnwindSafe for SVM<K>where
K: RefUnwindSafe,
impl<K> Send for SVM<K>where
K: Send,
impl<K> Sync for SVM<K>where
K: Sync,
impl<K> Unpin for SVM<K>where
K: Unpin,
impl<K> UnwindSafe for SVM<K>where
K: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more