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]

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]

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);

Get the number of classes.

Get the number of iterations.

Get the initialization algorithm.

Get the centroids Option<Matrix<f64>>.

Set the number of iterations.

Trait Implementations

impl<InitAlg: Debug + Initializer> Debug for KMeansClassifier<InitAlg>
[src]

Formats the value using the given formatter.

impl<InitAlg: Initializer> UnSupModel<Matrix<f64>, Vector<usize>> for KMeansClassifier<InitAlg>
[src]

Predict classes from data.

Model must be trained.

Train the classifier using input data.