public final class KMeansModel extends Object implements ClusterizationModel<Vector,Integer>, Exportable<KMeansModelFormat>, JSONWritable, DeployableObject
Modifier and Type | Class and Description |
---|---|
static class |
KMeansModel.KMeansJSONExportModel |
Constructor and Description |
---|
KMeansModel(Vector[] centers,
DistanceMeasure distanceMeasure)
Construct KMeans model with given centers and distanceMeasure measure.
|
Modifier and Type | Method and Description |
---|---|
int |
amountOfClusters()
Gets the clusters count.
|
Vector[] |
centers()
Get cluster centers.
|
DistanceMeasure |
distanceMeasure()
Distance measure.
|
boolean |
equals(Object obj) |
static KMeansModel |
fromJSON(Path path)
Loads KMeansModel from JSON file.
|
List<Object> |
getDependencies()
Returns dependencies of this object that can be object with class defined by client side and unknown for server.
|
int |
hashCode() |
Integer |
predict(Vector vec)
Make a prediction for the specified input arguments.
|
<P> void |
saveModel(Exporter<KMeansModelFormat,P> exporter,
P path)
Save model by the given path.
|
void |
toJSON(Path path) |
String |
toString() |
String |
toString(boolean pretty) |
KMeansModel |
withCentroids(Vector[] centers)
Set up the centroids.
|
KMeansModel |
withDistanceMeasure(DistanceMeasure distanceMeasure)
Set up the distance measure.
|
public KMeansModel(Vector[] centers, DistanceMeasure distanceMeasure)
centers
- Centers.distanceMeasure
- Distance measure.public DistanceMeasure distanceMeasure()
public int amountOfClusters()
amountOfClusters
in interface ClusterizationModel<Vector,Integer>
public KMeansModel withCentroids(Vector[] centers)
centers
- The parameter value.public KMeansModel withDistanceMeasure(DistanceMeasure distanceMeasure)
distanceMeasure
- The parameter value.public Vector[] centers()
centers
in interface ClusterizationModel<Vector,Integer>
public <P> void saveModel(Exporter<KMeansModelFormat,P> exporter, P path)
saveModel
in interface Exportable<KMeansModelFormat>
exporter
- Exporter.path
- Path to saved model.public String toString(boolean pretty)
toString
in interface IgniteModel<Vector,Integer>
pretty
- Use pretty mode.public List<Object> getDependencies()
getDependencies
in interface DeployableObject
public static KMeansModel fromJSON(Path path)
public void toJSON(Path path)
toJSON
in interface JSONWritable
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021