io.siddhi.extension.execution.streamingml.clustering.kmeans.util

## Class KMeansClusterer

- java.lang.Object
- - io.siddhi.extension.execution.streamingml.clustering.kmeans.util.KMeansClusterer

-     public class KMeansClusterer
      extends Object

  class containing all mathematical logic needed to perform kmeans

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KMeansClusterer()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Object[]` | `getAssociatedCentroidInfo(DataPoint currentDatapoint, KMeansModel model)` similar to findAssociatedCluster method but return an Object[] array with the distance to closest centroid and the coordinates of the closest centroid
    `static void` | `train(LinkedList<DataPoint> dataPointsArray, int numberOfEventsToRetrain, double decayRate, ExecutorService executorService, KMeansModel model, int numberOfClusters, int maximumIterations, int dimensionality)`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KMeansClusterer

          public KMeansClusterer()

  - ### Method Detail

    - #### train

          public static void train(LinkedList<DataPoint> dataPointsArray,
                                   int numberOfEventsToRetrain,
                                   double decayRate,
                                   ExecutorService executorService,
                                   KMeansModel model,
                                   int numberOfClusters,
                                   int maximumIterations,
                                   int dimensionality)

    - #### getAssociatedCentroidInfo

          public static Object[] getAssociatedCentroidInfo(DataPoint currentDatapoint,
                                                           KMeansModel model)

      similar to findAssociatedCluster method but return an Object[] array with the distance to closest centroid and the coordinates of the closest centroid
      Parameters:
        `currentDatapoint` - the current data point that will be the next centroid
        `model` - the KMeansModel
      Returns:
        an Object[] array as mentioned above

Copyright © 2025 WSO2. All rights reserved.