Class DecisionStump

    • Constructor Detail

      • DecisionStump

        public DecisionStump()
    • Method Detail

      • globalInfo

        public java.lang.String globalInfo()
        Returns a string describing classifier
        Returns:
        a description suitable for displaying in the explorer/experimenter gui
      • buildClassifier

        public void buildClassifier​(Instances instances)
                             throws java.lang.Exception
        Generates the classifier.
        Specified by:
        buildClassifier in interface Classifier
        Parameters:
        instances - set of instances serving as training data
        Throws:
        java.lang.Exception - if the classifier has not been generated successfully
      • distributionForInstance

        public double[] distributionForInstance​(Instance instance)
                                         throws java.lang.Exception
        Calculates the class membership probabilities for the given test instance.
        Specified by:
        distributionForInstance in interface Classifier
        Overrides:
        distributionForInstance in class AbstractClassifier
        Parameters:
        instance - the instance to be classified
        Returns:
        predicted class probability distribution
        Throws:
        java.lang.Exception - if distribution can't be computed
      • toSource

        public java.lang.String toSource​(java.lang.String className)
                                  throws java.lang.Exception
        Returns the decision tree as Java source code.
        Specified by:
        toSource in interface Sourcable
        Parameters:
        className - the classname of the generated code
        Returns:
        the tree as Java source code
        Throws:
        java.lang.Exception - if something goes wrong
      • toString

        public java.lang.String toString()
        Returns a description of the classifier.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a description of the classifier as a string.
      • main

        public static void main​(java.lang.String[] argv)
        Main method for testing this class.
        Parameters:
        argv - the options