Struct rusty_machine::learning::k_means::KMeansClassifier
[−]
[src]
pub struct KMeansClassifier<InitAlg: Initializer> { /* fields omitted */ }
K-Means Classification model.
Contains option for centroids. Specifies iterations and number of classes.
Usage
This model is used through the UnSupModel
trait. The model is
trained via the train
function with a matrix containing rows of
feature vectors.
The model will not check to ensure the data coming in is all valid. This responsibility lies with the user (for now).
Methods
impl KMeansClassifier<KPlusPlus>
[src]
fn new(k: usize) -> KMeansClassifier<KPlusPlus>
Constructs untrained k-means classifier model.
Requires number of classes to be specified. Defaults to 100 iterations and kmeans++ initialization.
Examples
use rusty_machine::learning::k_means::KMeansClassifier; let model = KMeansClassifier::new(5);
impl<InitAlg: Initializer> KMeansClassifier<InitAlg>
[src]
fn new_specified(k: usize,
iters: usize,
algo: InitAlg)
-> KMeansClassifier<InitAlg>
iters: usize,
algo: InitAlg)
-> KMeansClassifier<InitAlg>
Constructs untrained k-means classifier model.
Requires number of classes, number of iterations, and the initialization algorithm to use.
Examples
use rusty_machine::learning::k_means::{KMeansClassifier, Forgy}; let model = KMeansClassifier::new_specified(5, 42, Forgy);
fn k(&self) -> usize
Get the number of classes.
fn iters(&self) -> usize
Get the number of iterations.
fn init_algorithm(&self) -> &InitAlg
Get the initialization algorithm.
fn centroids(&self) -> &Option<Matrix<f64>>
Get the centroids Option<Matrix<f64>>
.
fn set_iters(&mut self, iters: usize)
Set the number of iterations.