public class KMeansTrainer extends SingleLabelDatasetTrainer<KMeansModel>
| Modifier and Type | Class and Description |
|---|---|
static class |
KMeansTrainer.TotalCostAndCounts
Service class used for statistics.
|
DatasetTrainer.EmptyDatasetExceptionenvironment| Constructor and Description |
|---|
KMeansTrainer() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkState(KMeansModel mdl) |
<K,V> KMeansModel |
fit(DatasetBuilder<K,V> datasetBuilder,
IgniteBiFunction<K,V,Vector> featureExtractor,
IgniteBiFunction<K,V,Double> lbExtractor)
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.
|
long |
getSeed()
Gets the seed number.
|
protected <K,V> KMeansModel |
updateModel(KMeansModel mdl,
DatasetBuilder<K,V> datasetBuilder,
IgniteBiFunction<K,V,Vector> featureExtractor,
IgniteBiFunction<K,V,Double> lbExtractor)
Gets state of model in arguments, update in according to new data and return new model.
|
KMeansTrainer |
withAmountOfClusters(int k)
Set up the amount of clusters.
|
KMeansTrainer |
withDistance(DistanceMeasure distance)
Set up the distance.
|
KMeansTrainer |
withEpsilon(double epsilon)
Set up the epsilon.
|
KMeansTrainer |
withMaxIterations(int maxIterations)
Set up the max number of iterations before convergence.
|
KMeansTrainer |
withSeed(long seed)
Set up the seed.
|
fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, setEnvironment, update, update, update, update, updatepublic <K,V> KMeansModel fit(DatasetBuilder<K,V> datasetBuilder, IgniteBiFunction<K,V,Vector> featureExtractor, IgniteBiFunction<K,V,Double> lbExtractor)
fit in class DatasetTrainer<KMeansModel,Double>K - Type of a key in upstream data.V - Type of a value in upstream data.datasetBuilder - Dataset builder.featureExtractor - Feature extractor.lbExtractor - Label extractor.protected <K,V> KMeansModel updateModel(KMeansModel mdl, DatasetBuilder<K,V> datasetBuilder, IgniteBiFunction<K,V,Vector> featureExtractor, IgniteBiFunction<K,V,Double> lbExtractor)
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.featureExtractor - Feature extractor.lbExtractor - Label extractor.protected boolean checkState(KMeansModel mdl)
checkState 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.public long getSeed()
public KMeansTrainer withSeed(long seed)
seed - The parameter value.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019