Documentation of 'medusa.spectral.KMeans' Java class
KMeans
medusa.spectral

Class KMeans



  • public class KMeans
    extends java.lang.Object
    Implements the k-means algorithm
    • Constructor Summary

      Constructors 
      Constructor and Description
      KMeans(int k, java.util.List<KMeansPoint> kMeansPoints)
      Returns a new instance of kMeans algorithm
      KMeans(int k, java.lang.String inputFileName)
      Returns a new instance of kMeans algorithm
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      medusa.spectral.cluster getCluster(int index)
      Returns the specified cluster by index
      java.util.Map<java.lang.String,java.lang.Integer> getClusterMap() 
      java.util.Vector<KMeansPoint>[] getClusters() 
      java.util.Vector getDataPoints()
      Returns the data points
      int getK()
      Returns the value of k
      int getSmallestClusterSize() 
      java.util.Vector<KMeansPoint> getVector() 
      static void main(java.lang.String[] args)
      Main method -- to test the kMeans class
      void readData()
      Reads the input data from the file and stores the data points in the vector
      void runKMeans()
      Runs the k-means algorithm over the data set
      java.lang.String toString()
      Returns the string output of the data points
      • Methods inherited from class java.lang.Object

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

      • KMeans

        public KMeans(int k,
                      java.lang.String inputFileName)
        Returns a new instance of kMeans algorithm
        Parameters:
        k - number of clusters
        inputFileName - name of the file containing input data
      • KMeans

        public KMeans(int k,
                      java.util.List<KMeansPoint> kMeansPoints)
        Returns a new instance of kMeans algorithm
        Parameters:
        k - number of clusters
        kMeansPoints - List containing objects of type kMeansPoint
    • Method Detail

      • readData

        public void readData()
                      throws java.io.IOException
        Reads the input data from the file and stores the data points in the vector
        Throws:
        java.io.IOException
      • getVector

        public java.util.Vector<KMeansPoint> getVector()
      • runKMeans

        public void runKMeans()
        Runs the k-means algorithm over the data set
      • getClusters

        public java.util.Vector<KMeansPoint>[] getClusters()
      • getK

        public int getK()
        Returns the value of k
        Returns:
        the value of k
      • getCluster

        public medusa.spectral.cluster getCluster(int index)
        Returns the specified cluster by index
        Parameters:
        index - index of the cluster to be returned
        Returns:
        return the specified cluster by index
      • toString

        public java.lang.String toString()
        Returns the string output of the data points
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string output of the data points
      • getDataPoints

        public java.util.Vector getDataPoints()
        Returns the data points
        Returns:
        the data points
      • getClusterMap

        public java.util.Map<java.lang.String,java.lang.Integer> getClusterMap()
      • getSmallestClusterSize

        public int getSmallestClusterSize()
      • main

        public static void main(java.lang.String[] args)
        Main method -- to test the kMeans class
        Parameters:
        args - command line arguments

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.