Class ResidualSplit

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, RevisionHandler

    public class ResidualSplit
    extends ClassifierSplitModel
    Helper class for logistic model trees (weka.classifiers.trees.lmt.LMT) to implement the splitting criterion based on residuals of the LogitBoost algorithm.
    Version:
    $Revision: 1.4 $
    Author:
    Niels Landwehr
    See Also:
    Serialized Form
    • Constructor Detail

      • ResidualSplit

        public ResidualSplit​(int attIndex)
        Creates a split object
        Parameters:
        attIndex - the index of the attribute to split on
    • Method Detail

      • buildClassifier

        public void buildClassifier​(Instances data,
                                    double[][] dataZs,
                                    double[][] dataWs)
                             throws java.lang.Exception
        Builds the split. Needs the Z/W values of LogitBoost for the set of instances.
        Throws:
        java.lang.Exception
      • entropyGain

        public double entropyGain()
                           throws java.lang.Exception
        Computes entropy gain for current split.
        Throws:
        java.lang.Exception
      • checkModel

        public boolean checkModel​(int minNumInstances)
        Checks if there are at least 2 subsets that contain >= minNumInstances.
      • leftSide

        public final java.lang.String leftSide​(Instances data)
        Returns name of splitting attribute (left side of condition).
        Specified by:
        leftSide in class ClassifierSplitModel
        Parameters:
        data - the data.
      • rightSide

        public final java.lang.String rightSide​(int index,
                                                Instances data)
        Prints the condition satisfied by instances in a subset.
        Specified by:
        rightSide in class ClassifierSplitModel
      • whichSubset

        public final int whichSubset​(Instance instance)
                              throws java.lang.Exception
        Description copied from class: ClassifierSplitModel
        Returns index of subset instance is assigned to. Returns -1 if instance is assigned to more than one subset.
        Specified by:
        whichSubset in class ClassifierSplitModel
        Throws:
        java.lang.Exception - if something goes wrong
      • getRevision

        public java.lang.String getRevision()
        Returns the revision string.
        Returns:
        the revision