milk.classifiers
Class MIWrapper

java.lang.Object
  |
  +--milk.classifiers.MIClassifier
        |
        +--milk.classifiers.MIWrapper
All Implemented Interfaces:
java.lang.Cloneable, MITransform, weka.core.OptionHandler, java.io.Serializable
Direct Known Subclasses:
SimpleMI

public class MIWrapper
extends MIClassifier
implements weka.core.OptionHandler, MITransform

Weighted Wrapper method from Eibe Valid options are:

-D
Turn on debugging output.

-W classname
Specify the full class name of a classifier as the basis (required).

-P method index
Set which method to use in testing: 1.arithmatic average; 2.geometric average. (default: 1)

See Also:
Serialized Form

Field Summary
protected  weka.core.Instances m_Attributes
          All attribute names
protected  weka.classifiers.Classifier m_Classifier
           
protected  int m_ClassIndex
          The index of the class attribute
protected  boolean m_Debug
          Debugging output
protected  int m_IdIndex
           
protected  int m_Method
           
protected  int m_NumClasses
          The number of the class labels
 
Constructor Summary
MIWrapper()
           
 
Method Summary
 void buildClassifier(Exemplars train)
          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 getMethod()
          Get the method used in testing.
 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 base classifier.
 void setDebug(boolean debug)
          Sets whether debugging output will be printed.
 void setMethod(int newMethod)
          Set the method used in testing.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 java.lang.String toString()
          Gets a string describing the classifier.
 weka.core.Instances transform(Exemplars train)
          transform the given exemplars to an Instances object.
 
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_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_Attributes

protected weka.core.Instances m_Attributes
All attribute names


m_Classifier

protected weka.classifiers.Classifier m_Classifier

m_Method

protected int m_Method
Constructor Detail

MIWrapper

public MIWrapper()
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.

-W classname
Specify the full class name of a classifier as the basis (required).

-P method_index
Set which method to use in testing: 1.arithmatic average; 2.geometric average. (default: 1)

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 base classifier.

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 classifier

setMethod

public void setMethod(int newMethod)
Set the method used in testing.

Parameters:
newMethod - the index of method to use.

getMethod

public int getMethod()
Get the method used in testing.

Returns:
the index of method used in testing.

transform

public weka.core.Instances transform(Exemplars train)
                              throws java.lang.Exception
Description copied from interface: MITransform
transform the given exemplars to an Instances object.

Specified by:
transform in interface MITransform
Returns:
the transformed instances
Throws:
java.lang.Exception - if transformation is not successful

buildClassifier

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

Specified by:
buildClassifier in class MIClassifier
Parameters:
train - the training data to be used for generating the boosted classifier.
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 distribution
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)