org.apache.ignite.ml.clustering.kmeans

## Class KMeansModel

- java.lang.Object
- - org.apache.ignite.ml.clustering.kmeans.KMeansModel

- All Implemented Interfaces:
    Serializable, AutoCloseable, ClusterizationModel<Vector,Integer>, DeployableObject, Exportable<KMeansModelFormat>, IgniteModel<Vector,Integer>, Model<Vector,Integer>

      public final class KMeansModel
      extends Object
      implements ClusterizationModel<Vector,Integer>, Exportable<KMeansModelFormat>, DeployableObject

  This class encapsulates result of clusterization by KMeans algorithm.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KMeansModel(Vector[] centers, DistanceMeasure distanceMeasure)` Construct KMeans model with given centers and distanceMeasure measure.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DistanceMeasure` | `distanceMeasure()` Distance measure.
    `boolean` | `equals(Object obj)`
    `int` | `getAmountOfClusters()` Gets the clusters count.
    `Vector[]` | `getCenters()` Get cluster centers.
    `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.
    `String` | `toString()`
    `String` | `toString(boolean pretty)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.ignite.ml.IgniteModel

      `andBefore, andThen, andThen, close, combine`

- - ### Constructor Detail

    - #### KMeansModel

          public KMeansModel(Vector[] centers,
                             DistanceMeasure distanceMeasure)

      Construct KMeans model with given centers and distanceMeasure measure.
      Parameters:
        `centers` - Centers.
        `distanceMeasure` - Distance measure.

  - ### Method Detail

    - #### distanceMeasure

          public DistanceMeasure distanceMeasure()

      Distance measure.

    - #### getAmountOfClusters

          public int getAmountOfClusters()

      Gets the clusters count.
      Specified by:
        `getAmountOfClusters` in interface `ClusterizationModel<Vector,Integer>`

    - #### getCenters

          public Vector[] getCenters()

      Get cluster centers.
      Specified by:
        `getCenters` in interface `ClusterizationModel<Vector,Integer>`

    - #### predict

          public Integer predict(Vector vec)

      Make a prediction for the specified input arguments.
      Specified by:
        `predict` in interface `Model<Vector,Integer>`
      Parameters:
        `vec` - Input arguments.
      Returns:
        Prediction result.

    - #### saveModel

          public <P> void saveModel(Exporter<KMeansModelFormat,P> exporter,
                                    P path)

      Save model by the given path.
      Specified by:
        `saveModel` in interface `Exportable<KMeansModelFormat>`
      Parameters:
        `exporter` - Exporter.
        `path` - Path to saved model.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toString

          public String toString(boolean pretty)

      Specified by:
        `toString` in interface `IgniteModel<Vector,Integer>`
      Parameters:
        `pretty` - Use pretty mode.

    - #### getDependencies

          public List<Object> getDependencies()

      Returns dependencies of this object that can be object with class defined by client side and unknown for server.
      Specified by:
        `getDependencies` in interface `DeployableObject`

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020