weka.classifiers.mi
Class MIWrapper

java.lang.Object
  extended by weka.classifiers.Classifier
      extended by weka.classifiers.SingleClassifierEnhancer
          extended by weka.classifiers.mi.MIWrapper
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, CapabilitiesHandler, MultiInstanceCapabilitiesHandler, OptionHandler, RevisionHandler, TechnicalInformationHandler

public class MIWrapper
extends SingleClassifierEnhancer
implements MultiInstanceCapabilitiesHandler, OptionHandler, TechnicalInformationHandler

A simple Wrapper method for applying standard propositional learners to multi-instance data.

For more information see:

E. T. Frank, X. Xu (2003). Applying propositional learning algorithms to multi-instance data. Department of Computer Science, University of Waikato, Hamilton, NZ.

BibTeX:

 @techreport{Frank2003,
    address = {Department of Computer Science, University of Waikato, Hamilton, NZ},
    author = {E. T. Frank and X. Xu},
    institution = {University of Waikato},
    month = {06},
    title = {Applying propositional learning algorithms to multi-instance data},
    year = {2003}
 }
 

Valid options are:

 -P [1|2|3]
  The method used in testing:
  1.arithmetic average
  2.geometric average
  3.max probability of positive bag.
  (default: 1)
 -A [0|1|2|3]
  The type of weight setting for each single-instance:
  0.keep the weight to be the same as the original value;
  1.weight = 1.0
  2.weight = 1.0/Total number of single-instance in the
   corresponding bag
  3. weight = Total number of single-instance / (Total
   number of bags * Total number of single-instance 
   in the corresponding bag).
  (default: 3)
 -D
  If set, classifier is run in debug mode and
  may output additional info to the console
 -W
  Full name of base classifier.
  (default: weka.classifiers.rules.ZeroR)
 
 Options specific to classifier weka.classifiers.rules.ZeroR:
 
 -D
  If set, classifier is run in debug mode and
  may output additional info to the console

Version:
$Revision: 1.5 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz), Xin Xu (xx5@cs.waikato.ac.nz)
See Also:
Serialized Form

Field Summary
static Tag[] TAGS_TESTMETHOD
          the test methods
static int TESTMETHOD_ARITHMETIC
          arithmetic average
static int TESTMETHOD_GEOMETRIC
          geometric average
static int TESTMETHOD_MAXPROB
          max probability of positive bag
 
Constructor Summary
MIWrapper()
           
 
Method Summary
 void buildClassifier(Instances data)
          Builds the classifier
 double[] distributionForInstance(Instance exmp)
          Computes the distribution for a given exemplar
 Capabilities getCapabilities()
          Returns default capabilities of the classifier.
 SelectedTag getMethod()
          Get the method used in testing.
 Capabilities getMultiInstanceCapabilities()
          Returns the capabilities of this multi-instance classifier for the relational data.
 java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
 java.lang.String getRevision()
          Returns the revision string.
 TechnicalInformation getTechnicalInformation()
          Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
 SelectedTag getWeightMethod()
          Returns the current weighting method for instances.
 java.lang.String globalInfo()
          Returns a string describing this filter
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] argv)
          Main method for testing this class.
 java.lang.String methodTipText()
          Returns the tip text for this property
 void setMethod(SelectedTag method)
          Set the method used in testing.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setWeightMethod(SelectedTag method)
          The new method for weighting the instances.
 java.lang.String toString()
          Gets a string describing the classifier.
 java.lang.String weightMethodTipText()
          Returns the tip text for this property
 
Methods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, getClassifier, setClassifier
 
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TESTMETHOD_ARITHMETIC

public static final int TESTMETHOD_ARITHMETIC
arithmetic average

See Also:
Constant Field Values

TESTMETHOD_GEOMETRIC

public static final int TESTMETHOD_GEOMETRIC
geometric average

See Also:
Constant Field Values

TESTMETHOD_MAXPROB

public static final int TESTMETHOD_MAXPROB
max probability of positive bag

See Also:
Constant Field Values

TAGS_TESTMETHOD

public static final Tag[] TAGS_TESTMETHOD
the test methods

Constructor Detail

MIWrapper

public MIWrapper()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing this filter

Returns:
a description of the filter suitable for displaying in the explorer/experimenter gui

getTechnicalInformation

public TechnicalInformation getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.

Specified by:
getTechnicalInformation in interface TechnicalInformationHandler
Returns:
the technical information about this class

listOptions

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

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class SingleClassifierEnhancer
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:

 -P [1|2|3]
  The method used in testing:
  1.arithmetic average
  2.geometric average
  3.max probability of positive bag.
  (default: 1)
 -A [0|1|2|3]
  The type of weight setting for each single-instance:
  0.keep the weight to be the same as the original value;
  1.weight = 1.0
  2.weight = 1.0/Total number of single-instance in the
   corresponding bag
  3. weight = Total number of single-instance / (Total
   number of bags * Total number of single-instance 
   in the corresponding bag).
  (default: 3)
 -D
  If set, classifier is run in debug mode and
  may output additional info to the console
 -W
  Full name of base classifier.
  (default: weka.classifiers.rules.ZeroR)
 
 Options specific to classifier weka.classifiers.rules.ZeroR:
 
 -D
  If set, classifier is run in debug mode and
  may output additional info to the console

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

weightMethodTipText

public java.lang.String weightMethodTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setWeightMethod

public void setWeightMethod(SelectedTag method)
The new method for weighting the instances.

Parameters:
method - the new method

getWeightMethod

public SelectedTag getWeightMethod()
Returns the current weighting method for instances.

Returns:
the current weighting method

methodTipText

public java.lang.String methodTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setMethod

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

Parameters:
method - the index of method to use.

getMethod

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

Returns:
the index of method used in testing.

getCapabilities

public Capabilities getCapabilities()
Returns default capabilities of the classifier.

Specified by:
getCapabilities in interface CapabilitiesHandler
Overrides:
getCapabilities in class SingleClassifierEnhancer
Returns:
the capabilities of this classifier
See Also:
Capabilities

getMultiInstanceCapabilities

public Capabilities getMultiInstanceCapabilities()
Returns the capabilities of this multi-instance classifier for the relational data.

Specified by:
getMultiInstanceCapabilities in interface MultiInstanceCapabilitiesHandler
Returns:
the capabilities of this object
See Also:
Capabilities

buildClassifier

public void buildClassifier(Instances data)
                     throws java.lang.Exception
Builds the classifier

Specified by:
buildClassifier in class Classifier
Parameters:
data - the training data to be used for generating the boosted classifier.
Throws:
java.lang.Exception - if the classifier could not be built successfully

distributionForInstance

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

Overrides:
distributionForInstance in class Classifier
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.

getRevision

public java.lang.String getRevision()
Returns the revision string.

Specified by:
getRevision in interface RevisionHandler
Overrides:
getRevision in class Classifier
Returns:
the revision

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)