Class ClassesToClusters

    • Constructor Detail

      • ClassesToClusters

        public ClassesToClusters()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Returns:
        a description suitable for displaying in the gui
      • canEvaluate

        public String canEvaluate​(weka.clusterers.Clusterer clusterer)
        Tests whether the clusterer can be evaluated.
        Specified by:
        canEvaluate in class AbstractClustererEvaluation
        Parameters:
        clusterer - the current clusterer
        Returns:
        null if successful, otherwise error message
      • init

        public ResultItem init​(weka.clusterers.Clusterer clusterer)
                        throws Exception
        Initializes the result item.
        Specified by:
        init in class AbstractClustererEvaluation
        Parameters:
        clusterer - the current clusterer
        Returns:
        the initialized history item
        Throws:
        Exception - if initialization fails
      • numClasses

        protected int numClasses()
        Returns the number of classes in the test set.
        Returns:
        the number of classes, -1 in case of error
      • classIndex

        protected int classIndex​(weka.core.Instances data)
        Returns the index of the selected class attribute in the provided dataset.
        Parameters:
        data - the dataset to get the class index for
        Returns:
        the class index, -1 if failed to locate attribute
      • removeClassAttribute

        protected weka.core.Instances removeClassAttribute​(weka.core.Instances data)
        Removes the class attribute from the dataset (if present).
        Parameters:
        data - the dataset to process
        Returns:
        the clean dataset
      • toMatrixString

        protected String toMatrixString​(int numClusters,
                                        int[][] counts,
                                        int[] clusterTotals,
                                        weka.core.Instances inst)
                                 throws Exception
        Returns a "confusion" style matrix of classes to clusters assignments
        Parameters:
        counts - the counts of classes for each cluster
        clusterTotals - total number of examples in each cluster
        inst - the training instances (with class)
        Returns:
        the "confusion" style matrix as string
        Throws:
        Exception - if matrix can't be generated
      • doEvaluate

        protected void doEvaluate​(weka.clusterers.Clusterer clusterer,
                                  ResultItem item)
                           throws Exception
        Evaluates the clusterer and updates the result item.
        Specified by:
        doEvaluate in class AbstractClustererEvaluation
        Parameters:
        clusterer - the current clusterer
        item - the item to update
        Throws:
        Exception - if evaluation fails