pub struct KMeansClassifier<InitAlg: Initializer> { /* private fields */ }
Expand description

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

Implementations

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

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

Formats the value using the given formatter. Read more

Predict classes from data.

Model must be trained.

Train the classifier using input data.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.