Documentation of 'jminhep.algorithms.KMeansAlg' Java class
KMeansAlg
jminhep.algorithms

Class KMeansAlg



  • public class KMeansAlg
    extends java.lang.Object
    The standard K-means algorithm.
    • Constructor Summary

      Constructors 
      Constructor and Description
      KMeansAlg(DataHolder data)
      Initialize the standard K-means algorithm
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void delete()
      Clear
      void generateSeed()
      Generate random seeds for initial centroids
      DataHolder getCenters()
      Returns cluster centers
      int getClusters()
      Get number of clusters
      double getCompactness()
      This method returns the Compactness
      int getError()
      Return error
      java.lang.String getName()
      Name for this algorithm.
      int[] getNumberPoints()
      Returns the number of points in each cluster
      double[][] getSeed()
      Return seeds
      DataHolder getSeedHolder()
      Get positions of seeds
      long getSize()
      This method returns the estimated size (steps) for this task.
      void run()
      Run classic K-Means clustering algorithm.
      void run(int Iter)
      Runs the k-means several iterations to find best seed values Only iteration with the best compactness is taken.
      void runKM()
      Classic K-Means clustering algorithm.
      void setClusters(int numClusters)
      Set the designed number of clusters
      void setOptions(int maxIterations, double epsilon)
      Set initial options for calculations
      void setSeed(double[][] seed)
      Set seeds by hand
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KMeansAlg

        public KMeansAlg(DataHolder data)
        Initialize the standard K-means algorithm
        Parameters:
        data - input data
    • Method Detail

      • setClusters

        public void setClusters(int numClusters)
        Set the designed number of clusters
        Parameters:
        numClusters - expected number of clusters
      • getClusters

        public int getClusters()
        Get number of clusters
        Returns:
        number of clusters
      • generateSeed

        public void generateSeed()
        Generate random seeds for initial centroids
      • setSeed

        public void setSeed(double[][] seed)
        Set seeds by hand
        Parameters:
        seed - positions of seeds
      • getSeed

        public double[][] getSeed()
        Return seeds
        Returns:
        seeds
      • setOptions

        public void setOptions(int maxIterations,
                               double epsilon)
        Set initial options for calculations
        Parameters:
        maxIterations - the maximum number of iterations.
        epsilon - a small value used to verify if clustering has converged.
      • delete

        public void delete()
        Clear
      • getCenters

        public DataHolder getCenters()
        Returns cluster centers
        Returns:
        DataHolder with center positions
      • getSeedHolder

        public DataHolder getSeedHolder()
        Get positions of seeds
        Returns:
        seed positions
      • getNumberPoints

        public int[] getNumberPoints()
        Returns the number of points in each cluster
        Returns:
        int[] getNumberPoints
      • run

        public void run()
        Run classic K-Means clustering algorithm. Seeds will be generated automatically
      • runKM

        public void runKM()
        Classic K-Means clustering algorithm. Seeds are not set. Instead, consider the method run()
      • getCompactness

        public double getCompactness()
        This method returns the Compactness
        Returns:
        compactness value
      • run

        public void run(int Iter)
        Runs the k-means several iterations to find best seed values Only iteration with the best compactness is taken.
        Parameters:
        Iter - Number of iterations
      • getError

        public int getError()
        Return error
        Returns:
        zero if no errors
      • getSize

        public long getSize()
        This method returns the estimated size (steps) for this task.
      • getName

        public java.lang.String getName()
        Name for this algorithm.
        Returns:

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.