Class ClassifierSplitModel

java.lang.Object
weka.classifiers.trees.j48.ClassifierSplitModel
All Implemented Interfaces:
Serializable, Cloneable, RevisionHandler
Direct Known Subclasses:
BinC45Split, C45Split, NBTreeNoSplit, NBTreeSplit, NoSplit, ResidualSplit

public abstract class ClassifierSplitModel extends Object implements Cloneable, Serializable, RevisionHandler
Abstract class for classification models that can be used recursively to split the data.
Version:
$Revision: 15122 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz)
See Also:
  • Constructor Details

    • ClassifierSplitModel

      public ClassifierSplitModel()
  • Method Details

    • clone

      public Object clone()
      Allows to clone a model (shallow copy).
    • buildClassifier

      public abstract void buildClassifier(Instances instances) throws Exception
      Builds the classifier split model for the given set of instances.
      Throws:
      Exception - if something goes wrong
    • checkModel

      public final boolean checkModel()
      Checks if generated model is valid.
    • classifyInstance

      public final double classifyInstance(Instance instance) throws Exception
      Classifies a given instance.
      Throws:
      Exception - if something goes wrong
    • classProb

      public double classProb(int classIndex, Instance instance, int theSubset) throws Exception
      Gets class probability for instance.
      Throws:
      Exception - if something goes wrong
    • classProbLaplace

      public double classProbLaplace(int classIndex, Instance instance, int theSubset) throws Exception
      Gets class probability for instance.
      Throws:
      Exception - if something goes wrong
    • codingCost

      public double codingCost()
      Returns coding costs of model. Returns 0 if not overwritten.
    • distribution

      public final Distribution distribution()
      Returns the distribution of class values induced by the model.
    • leftSide

      public abstract String leftSide(Instances data)
      Prints left side of condition satisfied by instances.
      Parameters:
      data - the data.
    • rightSide

      public abstract String rightSide(int index, Instances data)
      Prints left side of condition satisfied by instances in subset index.
    • dumpLabel

      public final String dumpLabel(int index, Instances data) throws Exception
      Prints label for subset index of instances (eg class).
      Throws:
      Exception - if something goes wrong
    • sourceClass

      public final String sourceClass(int index, Instances data) throws Exception
      Throws:
      Exception
    • sourceExpression

      public abstract String sourceExpression(int index, Instances data)
    • dumpModel

      public final String dumpModel(Instances data) throws Exception
      Prints the split model.
      Throws:
      Exception - if something goes wrong
    • numSubsets

      public final int numSubsets()
      Returns the number of created subsets for the split.
    • resetDistribution

      public void resetDistribution(Instances data) throws Exception
      Sets distribution associated with model.
      Throws:
      Exception
    • setDistribution

      public void setDistribution(Distribution dist)
      Sets the distribution associated with model.
      Parameters:
      dist -
    • split

      public Instances[] split(Instances data) throws Exception
      Splits the given set of instances into subsets.
      Throws:
      Exception - if something goes wrong
    • weights

      public abstract double[] weights(Instance instance)
      Returns weights if instance is assigned to more than one subset. Returns null if instance is only assigned to one subset.
    • whichSubset

      public abstract int whichSubset(Instance instance) throws Exception
      Returns index of subset instance is assigned to. Returns -1 if instance is assigned to more than one subset.
      Throws:
      Exception - if something goes wrong