Class HamerlyKMeans.Instance

    • Field Detail

      • sums

        double[][] sums
        Sum aggregate for the new mean.
      • newmeans

        double[][] newmeans
        Scratch space for new means.
      • sep

        double[] sep
        Separation of means / distance moved.
    • Constructor Detail

      • Instance

        public Instance​(Relation<? extends NumberVector> relation,
                        NumberVectorDistance<?> df,
                        double[][] means)
        Constructor.
        Parameters:
        relation - Relation
        df - Distance function
        means - Initial means
    • Method Detail

      • iterate

        protected int iterate​(int iteration)
        Description copied from class: AbstractKMeans.Instance
        Main loop function.
        Specified by:
        iterate in class AbstractKMeans.Instance
        Parameters:
        iteration - Iteration number (beginning at 1)
        Returns:
        Number of reassigned points
      • initialAssignToNearestCluster

        protected int initialAssignToNearestCluster()
        Perform initial cluster assignment.
        Returns:
        Number of changes (i.e., relation size)
      • recomputeSeperation

        protected void recomputeSeperation​(double[] sep)
        Recompute the separation of cluster means.

        Used by Hamerly.

        Parameters:
        sep - Output array of separation (half-sqrt scaled)
      • updateBounds

        protected void updateBounds​(double[] move)
        Update the bounds for k-means.
        Parameters:
        move - Movement of centers