milk.classifiers
Class MIBoost

java.lang.Object
  |
  +--milk.classifiers.MIClassifier
        |
        +--milk.classifiers.MIBoost
All Implemented Interfaces:
java.lang.Cloneable, weka.core.OptionHandler, java.io.Serializable

public class MIBoost
extends MIClassifier
implements weka.core.OptionHandler

MI AdaBoost method, consider the geometric mean of posterior of instances inside a bag (arithmatic mean of log-posterior) and the expectation for a bag is taken inside the loss function. Exact derivation from Hastie et al. paper

See Also:
Serialized Form

Field Summary
protected  weka.core.Instances m_Attributes
          All attribute names
protected  double[] m_Beta
          Voting weights of models
protected  int[] m_Classes
          Class labels for each bag
protected  weka.classifiers.Classifier m_Classifier
          The model base classifier to use
protected  int m_ClassIndex
          The index of the class attribute
protected  boolean m_Debug
          Debugging output
protected  int m_DiscretizeBin
           
protected  weka.filters.unsupervised.attribute.Discretize m_Filter
           
protected  int m_IdIndex
           
protected  int m_MaxIterations
           
protected  weka.classifiers.Classifier[] m_Models
           
protected  int m_NumClasses
          The number of the class labels
 
Constructor Summary
MIBoost()
           
 
Method Summary
 void buildClassifier(Exemplars exps)
          Builds the classifier
 double[] distributionForExemplar(Exemplar exmp)
          Computes the distribution for a given exemplar
 weka.classifiers.Classifier getClassifier()
          Get the classifier used as the classifier
 boolean getDebug()
          Gets whether debugging output will be printed.
 int getDiscretizeBin()
          Get the number of bins in discretization
 int getMaxIterations()
          Get the maximum number of boost iterations
 java.lang.String[] getOptions()
          Gets the current settings of the classifier.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options
static void main(java.lang.String[] argv)
          Main method for testing this class.
 void setClassifier(weka.classifiers.Classifier newClassifier)
          Set the classifier for boosting.
 void setDebug(boolean debug)
          Sets whether debugging output will be printed.
 void setDiscretizeBin(int bin)
          Set the number of bins in discretization
 void setMaxIterations(int maxIterations)
          Set the maximum number of boost iterations
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 java.lang.String toString()
          Gets a string describing the classifier.
 
Methods inherited from class milk.classifiers.MIClassifier
classifyExemplar, forName, makeCopies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_ClassIndex

protected int m_ClassIndex
The index of the class attribute


m_Models

protected weka.classifiers.Classifier[] m_Models

m_NumClasses

protected int m_NumClasses
The number of the class labels


m_IdIndex

protected int m_IdIndex

m_Debug

protected boolean m_Debug
Debugging output


m_Classes

protected int[] m_Classes
Class labels for each bag


m_Attributes

protected weka.core.Instances m_Attributes
All attribute names


m_Classifier

protected weka.classifiers.Classifier m_Classifier
The model base classifier to use


m_Beta

protected double[] m_Beta
Voting weights of models


m_MaxIterations

protected int m_MaxIterations

m_DiscretizeBin

protected int m_DiscretizeBin

m_Filter

protected weka.filters.unsupervised.attribute.Discretize m_Filter
Constructor Detail

MIBoost

public MIBoost()
Method Detail

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options

Specified by:
listOptions in interface weka.core.OptionHandler
Returns:
an enumeration of all the available options

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options. Valid options are:

-D
Turn on debugging output.

Specified by:
setOptions in interface weka.core.OptionHandler
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the classifier.

Specified by:
getOptions in interface weka.core.OptionHandler
Returns:
an array of strings suitable for passing to setOptions

setDebug

public void setDebug(boolean debug)
Sets whether debugging output will be printed.

Parameters:
debug - true if debugging output should be printed

getDebug

public boolean getDebug()
Gets whether debugging output will be printed.

Returns:
true if debugging output will be printed

setClassifier

public void setClassifier(weka.classifiers.Classifier newClassifier)
Set the classifier for boosting.

Parameters:
newClassifier - the Classifier to use.

getClassifier

public weka.classifiers.Classifier getClassifier()
Get the classifier used as the classifier

Returns:
the classifier used as the base classifier

setMaxIterations

public void setMaxIterations(int maxIterations)
Set the maximum number of boost iterations

Parameters:
maxIterations - the maximum number of boost iterations

getMaxIterations

public int getMaxIterations()
Get the maximum number of boost iterations

Returns:
the maximum number of boost iterations

setDiscretizeBin

public void setDiscretizeBin(int bin)
Set the number of bins in discretization

Parameters:
bin - the number of bins in discretization

getDiscretizeBin

public int getDiscretizeBin()
Get the number of bins in discretization

Returns:
the number of bins in discretization

buildClassifier

public void buildClassifier(Exemplars exps)
                     throws java.lang.Exception
Builds the classifier

Specified by:
buildClassifier in class MIClassifier
Parameters:
exps - set of exemplars serving as training data
Throws:
java.lang.Exception - if the classifier could not be built successfully

distributionForExemplar

public double[] distributionForExemplar(Exemplar exmp)
                                 throws java.lang.Exception
Computes the distribution for a given exemplar

Overrides:
distributionForExemplar in class MIClassifier
Parameters:
exmp - the exemplar for which distribution is computed
Returns:
the classification
Throws:
java.lang.Exception - if the distribution can't be computed successfully

toString

public java.lang.String toString()
Gets a string describing the classifier.

Overrides:
toString in class java.lang.Object
Returns:
a string describing the classifer built.

main

public static void main(java.lang.String[] argv)
Main method for testing this class.

Parameters:
argv - should contain the command line arguments to the scheme (see Evaluation)