weka.classifiers.trees.j48

## Class ClassifierSplitModel

- java.lang.Object
- - weka.classifiers.trees.j48.ClassifierSplitModel

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, RevisionHandler
  Direct Known Subclasses:
    BinC45Split, C45Split, NBTreeNoSplit, NBTreeSplit, NoSplit, ResidualSplit

      public abstract class ClassifierSplitModel
      extends java.lang.Object
      implements java.lang.Cloneable, java.io.Serializable, RevisionHandler

  Abstract class for classification models that can be used recursively to split the data.
  Version:
    $Revision: 13477 $
  Author:
    Eibe Frank (eibe@cs.waikato.ac.nz)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClassifierSplitModel()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `buildClassifier(Instances instances)` Builds the classifier split model for the given set of instances.
    `boolean` | `checkModel()` Checks if generated model is valid.
    `double` | `classifyInstance(Instance instance)` Classifies a given instance.
    `double` | `classProb(int classIndex, Instance instance, int theSubset)` Gets class probability for instance.
    `double` | `classProbLaplace(int classIndex, Instance instance, int theSubset)` Gets class probability for instance.
    `java.lang.Object` | `clone()` Allows to clone a model (shallow copy).
    `double` | `codingCost()` Returns coding costs of model.
    `Distribution` | `distribution()` Returns the distribution of class values induced by the model.
    `java.lang.String` | `dumpLabel(int index, Instances data)` Prints label for subset index of instances (eg class).
    `java.lang.String` | `dumpModel(Instances data)` Prints the split model.
    `abstract java.lang.String` | `leftSide(Instances data)` Prints left side of condition satisfied by instances.
    `int` | `numSubsets()` Returns the number of created subsets for the split.
    `void` | `resetDistribution(Instances data)` Sets distribution associated with model.
    `abstract java.lang.String` | `rightSide(int index, Instances data)` Prints left side of condition satisfied by instances in subset index.
    `void` | `setDistribution(Distribution dist)` Sets the distribution associated with model.
    `java.lang.String` | `sourceClass(int index, Instances data)`
    `abstract java.lang.String` | `sourceExpression(int index, Instances data)`
    `Instances[]` | `split(Instances data)` Splits the given set of instances into subsets.
    `abstract double[]` | `weights(Instance instance)` Returns weights if instance is assigned to more than one subset.
    `abstract int` | `whichSubset(Instance instance)` Returns index of subset instance is assigned to.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface weka.core.RevisionHandler

      `getRevision`

- - ### Constructor Detail

    - #### ClassifierSplitModel

          public ClassifierSplitModel()

  - ### Method Detail

    - #### clone

          public java.lang.Object clone()

      Allows to clone a model (shallow copy).
      Overrides:
        `clone` in class `java.lang.Object`

    - #### buildClassifier

          public abstract void buildClassifier(Instances instances)
                                        throws java.lang.Exception

      Builds the classifier split model for the given set of instances.
      Throws:
        `java.lang.Exception` - if something goes wrong

    - #### checkModel

          public final boolean checkModel()

      Checks if generated model is valid.

    - #### classifyInstance

          public final double classifyInstance(Instance instance)
                                        throws java.lang.Exception

      Classifies a given instance.
      Throws:
        `java.lang.Exception` - if something goes wrong

    - #### classProb

          public double classProb(int classIndex,
                                  Instance instance,
                                  int theSubset)
                           throws java.lang.Exception

      Gets class probability for instance.
      Throws:
        `java.lang.Exception` - if something goes wrong

    - #### classProbLaplace

          public double classProbLaplace(int classIndex,
                                         Instance instance,
                                         int theSubset)
                                  throws java.lang.Exception

      Gets class probability for instance.
      Throws:
        `java.lang.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 java.lang.String leftSide(Instances data)

      Prints left side of condition satisfied by instances.
      Parameters:
        `data` - the data.

    - #### rightSide

          public abstract java.lang.String rightSide(int index,
                                                     Instances data)

      Prints left side of condition satisfied by instances in subset index.

    - #### dumpLabel

          public final java.lang.String dumpLabel(int index,
                                                  Instances data)
                                           throws java.lang.Exception

      Prints label for subset index of instances (eg class).
      Throws:
        `java.lang.Exception` - if something goes wrong

    - #### sourceClass

          public final java.lang.String sourceClass(int index,
                                                    Instances data)
                                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### sourceExpression

          public abstract java.lang.String sourceExpression(int index,
                                                            Instances data)

    - #### dumpModel

          public final java.lang.String dumpModel(Instances data)
                                           throws java.lang.Exception

      Prints the split model.
      Throws:
        `java.lang.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 java.lang.Exception

      Sets distribution associated with model.
      Throws:
        `java.lang.Exception`

    - #### setDistribution

          public void setDistribution(Distribution dist)

      Sets the distribution associated with model.
      Parameters:
        `dist` -

    - #### split

          public final Instances[] split(Instances data)
                                  throws java.lang.Exception

      Splits the given set of instances into subsets.
      Throws:
        `java.lang.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 java.lang.Exception

      Returns index of subset instance is assigned to. Returns -1 if instance is assigned to more than one subset.
      Throws:
        `java.lang.Exception` - if something goes wrong