public class KMeansTrainer extends SingleLabelDatasetTrainer<KMeansModel>
| Modifier and Type | Class and Description |
|---|---|
static class |
KMeansTrainer.TotalCostAndCounts
Service class used for statistics.
|
DatasetTrainer.EmptyDatasetExceptionenvBuilder, environment| Constructor and Description |
|---|
KMeansTrainer() |
| Modifier and Type | Method and Description |
|---|---|
<K,V> KMeansModel |
fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> preprocessor)
Trains model based on the specified data.
|
int |
getAmountOfClusters()
Gets the amount of clusters.
|
DistanceMeasure |
getDistance()
Gets the distance.
|
double |
getEpsilon()
Gets the epsilon.
|
int |
getMaxIterations()
Gets the max number of iterations before convergence.
|
boolean |
isUpdateable(KMeansModel mdl) |
protected <K,V> KMeansModel |
updateModel(KMeansModel mdl,
DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> preprocessor)
Trains new model taken previous one as a first approximation.
|
KMeansTrainer |
withAmountOfClusters(int k)
Set up the amount of clusters.
|
KMeansTrainer |
withDistance(DistanceMeasure distance)
Set up the distance.
|
KMeansTrainer |
withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)
Changes learning Environment.
|
KMeansTrainer |
withEpsilon(double epsilon)
Set up the epsilon.
|
KMeansTrainer |
withMaxIterations(int maxIterations)
Set up the max number of iterations before convergence.
|
fit, fit, fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, identityTrainer, learningEnvironment, update, update, update, update, update, withConvertedLabelspublic <K,V> KMeansModel fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)
fitWithInitializedDeployingContext in class DatasetTrainer<KMeansModel,Double>K - Type of a key in upstream data.V - Type of a value in upstream data.datasetBuilder - Dataset builder.preprocessor - Extractor of UpstreamEntry into LabeledVector.public KMeansTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)
withEnvironmentBuilder in class DatasetTrainer<KMeansModel,Double>envBuilder - Learning environment builder.protected <K,V> KMeansModel updateModel(KMeansModel mdl, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)
updateModel in class DatasetTrainer<KMeansModel,Double>K - Type of a key in upstream data.V - Type of a value in upstream data.mdl - Learned model.datasetBuilder - Dataset builder.preprocessor - Extractor of UpstreamEntry into LabeledVector.public boolean isUpdateable(KMeansModel mdl)
isUpdateable in class DatasetTrainer<KMeansModel,Double>mdl - Model.public int getAmountOfClusters()
public KMeansTrainer withAmountOfClusters(int k)
k - The parameter value.public int getMaxIterations()
public KMeansTrainer withMaxIterations(int maxIterations)
maxIterations - The parameter value.public double getEpsilon()
public KMeansTrainer withEpsilon(double epsilon)
epsilon - The parameter value.public DistanceMeasure getDistance()
public KMeansTrainer withDistance(DistanceMeasure distance)
distance - The parameter value.
GridGain In-Memory Computing Platform : ver. 8.9.26 Release Date : October 16 2025