milk.classifiers
Class SimpleMI

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

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

Avg of feature data and reduce MI data into mono-instance Valid options are:

-M method index
Set which method to use in transformation: 1.arithmatic average; 2.geometric centor for each bag. (default: 1)

See Also:
Serialized Form

Field Summary
protected  Exemplars m_Exemplars
           
protected  int m_TransformMethod
           
 
Fields inherited from class milk.classifiers.MIWrapper
m_Attributes, m_Classifier, m_ClassIndex, m_Debug, m_IdIndex, m_Method, m_NumClasses
 
Constructor Summary
SimpleMI()
           
 
Method Summary
 void buildClassifier(Exemplars train)
          Builds the classifier
 double classifyExemplar(Exemplar exmp)
          Computes the distribution for a given exemplar
 java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
 int getTransformMethod()
          Get the method used in transformation.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] argv)
          Main method for testing this class.
static double[] minimax(weka.core.Instances data, int attIndex)
          Get the minimal and maximal value of a certain attribute in a certain data
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setTransformMethod(int newMethod)
          Set the method used in transformation.
 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.MIWrapper
distributionForExemplar, getClassifier, getDebug, getMethod, setClassifier, setDebug, setMethod
 
Methods inherited from class milk.classifiers.MIClassifier
forName, makeCopies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_TransformMethod

protected int m_TransformMethod

m_Exemplars

protected Exemplars m_Exemplars
Constructor Detail

SimpleMI

public SimpleMI()
Method Detail

listOptions

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

Specified by:
listOptions in interface weka.core.OptionHandler
Overrides:
listOptions in class MIWrapper
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:

-M method_index
Set which method to use in transformation: 1.arithmatic average; 2.geometric centor of a bag (default: 1)

Specified by:
setOptions in interface weka.core.OptionHandler
Overrides:
setOptions in class MIWrapper
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
Overrides:
getOptions in class MIWrapper
Returns:
an array of strings suitable for passing to setOptions

setTransformMethod

public void setTransformMethod(int newMethod)
Set the method used in transformation.

Parameters:
newMethod - the index of method to use.

getTransformMethod

public int getTransformMethod()
Get the method used in transformation.

Returns:
the index of method used.

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
Overrides:
transform in class MIWrapper
Returns:
the transformed instances
Throws:
java.lang.Exception - if transformation is not successful

minimax

public static double[] minimax(weka.core.Instances data,
                               int attIndex)
Get the minimal and maximal value of a certain attribute in a certain data

Parameters:
data - the data
attIndex - the index of the attribute
Returns:
the double array containing in entry 0 for min and 1 for max.

buildClassifier

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

Overrides:
buildClassifier in class MIWrapper
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

classifyExemplar

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

Overrides:
classifyExemplar 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 MIWrapper
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)