Class KMeansAggregator

All Implemented Interfaces:
Serializable, scala.Serializable

public class KMeansAggregator extends Object implements scala.Serializable
KMeansAggregator computes the distances and updates the centers for blocks in sparse or dense matrix in an online fashion. param: centerMatrix The matrix containing center vectors. param: k The number of clusters. param: numFeatures The number of features. param: distanceMeasure The distance measure. When 'euclidean' is chosen, the instance blocks should contains the squared norms in the labels field; When 'cosine' is chosen, the vectors should be already normalized.
See Also:
  • Constructor Details

    • KMeansAggregator

      public KMeansAggregator(DenseMatrix centerMatrix, int k, int numFeatures, String distanceMeasure)
  • Method Details

    • add

      public KMeansAggregator add( block)
    • centerMatrix

      public DenseMatrix centerMatrix()
    • costSum

      public double costSum()
    • count

      public long count()
    • distanceMeasure

      public String distanceMeasure()
    • k

      public int k()
    • numFeatures

      public int numFeatures()
    • sumMat

      public DenseMatrix sumMat()
    • weightSum

      public double weightSum()
    • weightSumVec

      public DenseVector weightSumVec()