weka.classifiers.trees.lmt
Class ResidualSplit

java.lang.Object
  extended byweka.classifiers.trees.j48.ClassifierSplitModel
      extended byweka.classifiers.trees.lmt.ResidualSplit
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

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.1 $
Author:
Niels Landwehr
See Also:
Serialized Form

Field Summary
protected  int m_attIndex
          The index of the attribute selected for the split
protected  Attribute m_attribute
          The attribute selected for the split
protected  Instances m_data
          The set of instances
protected  double[][] m_dataWs
          The LogitBoost-weights for the set of instances
protected  double[][] m_dataZs
          The Z-values (LogitBoost response) for the set of instances
protected  int m_numClasses
          Number of classed
protected  int m_numInstances
          Number of instances in the set
protected  double m_splitPoint
          The split point (for numeric attributes)
 
Fields inherited from class weka.classifiers.trees.j48.ClassifierSplitModel
m_distribution, m_numSubsets
 
Constructor Summary
ResidualSplit(int attIndex)
          Creates a split object
 
Method Summary
 void buildClassifier(Instances data)
          Method not in use
 void buildClassifier(Instances data, double[][] dataZs, double[][] dataWs)
          Builds the split.
 boolean checkModel(int minNumInstances)
          Checks if there are at least 2 subsets that contain >= minNumInstances.
protected  double entropy(double[][] dataZs, double[][] dataWs)
          Helper function to compute entropy from Z/W values.
 double entropyGain()
          Computes entropy gain for current split.
protected  boolean getSplitPoint()
          Selects split point for numeric attribute.
 java.lang.String leftSide(Instances data)
          Returns name of splitting attribute (left side of condition).
 java.lang.String rightSide(int index, Instances data)
          Prints the condition satisfied by instances in a subset.
 java.lang.String sourceExpression(int index, Instances data)
          Method not in use
 double[] weights(Instance instance)
          Method not in use
 int whichSubset(Instance instance)
          Returns index of subset instance is assigned to.
 
Methods inherited from class weka.classifiers.trees.j48.ClassifierSplitModel
checkModel, classifyInstance, classProb, classProbLaplace, clone, codingCost, distribution, dumpLabel, dumpModel, numSubsets, resetDistribution, sourceClass, split
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_attribute

protected Attribute m_attribute
The attribute selected for the split


m_attIndex

protected int m_attIndex
The index of the attribute selected for the split


m_numInstances

protected int m_numInstances
Number of instances in the set


m_numClasses

protected int m_numClasses
Number of classed


m_data

protected Instances m_data
The set of instances


m_dataZs

protected double[][] m_dataZs
The Z-values (LogitBoost response) for the set of instances


m_dataWs

protected double[][] m_dataWs
The LogitBoost-weights for the set of instances


m_splitPoint

protected double m_splitPoint
The split point (for numeric attributes)

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

getSplitPoint

protected boolean getSplitPoint()
                         throws java.lang.Exception
Selects split point for numeric attribute.

Throws:
java.lang.Exception

entropyGain

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

Throws:
java.lang.Exception

entropy

protected double entropy(double[][] dataZs,
                         double[][] dataWs)
Helper function to compute entropy from Z/W values.


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

buildClassifier

public void buildClassifier(Instances data)
Method not in use

Specified by:
buildClassifier in class ClassifierSplitModel

weights

public final double[] weights(Instance instance)
Method not in use

Specified by:
weights in class ClassifierSplitModel

sourceExpression

public final java.lang.String sourceExpression(int index,
                                               Instances data)
Method not in use

Specified by:
sourceExpression in class ClassifierSplitModel