Class SimpleMI

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, CapabilitiesHandler, MultiInstanceCapabilitiesHandler, OptionHandler, RevisionHandler

    public class SimpleMI
    extends SingleClassifierEnhancer
    implements OptionHandler, MultiInstanceCapabilitiesHandler
    Reduces MI data into mono-instance data.

    Valid options are:

     -M [1|2|3]
      The method used in transformation:
      1.arithmatic average; 2.geometric centor;
      3.using minimax combined features of a bag (default: 1)
     
      Method 3:
      Define s to be the vector of the coordinate-wise maxima
      and minima of X, ie., 
      s(X)=(minx1, ..., minxm, maxx1, ...,maxxm), transform
      the exemplars into mono-instance which contains attributes
      s(X)
     -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: 9144 $
    Author:
    Eibe Frank (eibe@cs.waikato.ac.nz), Xin Xu (xx5@cs.waikato.ac.nz), Lin Dong (ld21@cs.waikato.ac.nz)
    See Also:
    Serialized Form
    • Field Detail

      • TRANSFORMMETHOD_ARITHMETIC

        public static final int TRANSFORMMETHOD_ARITHMETIC
        arithmetic average
        See Also:
        Constant Field Values
      • TRANSFORMMETHOD_GEOMETRIC

        public static final int TRANSFORMMETHOD_GEOMETRIC
        geometric average
        See Also:
        Constant Field Values
      • TRANSFORMMETHOD_MINIMAX

        public static final int TRANSFORMMETHOD_MINIMAX
        using minimax combined features of a bag
        See Also:
        Constant Field Values
      • TAGS_TRANSFORMMETHOD

        public static final Tag[] TAGS_TRANSFORMMETHOD
        the transformation methods
    • Constructor Detail

      • SimpleMI

        public SimpleMI()
    • 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
      • setOptions

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

        Valid options are:

         -M [1|2|3]
          The method used in transformation:
          1.arithmatic average; 2.geometric centor;
          3.using minimax combined features of a bag (default: 1)
         
          Method 3:
          Define s to be the vector of the coordinate-wise maxima
          and minima of X, ie., 
          s(X)=(minx1, ..., minxm, maxx1, ...,maxxm), transform
          the exemplars into mono-instance which contains attributes
          s(X)
         -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
      • transformMethodTipText

        public java.lang.String transformMethodTipText()
        Returns the tip text for this property
        Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui
      • setTransformMethod

        public void setTransformMethod​(SelectedTag newMethod)
        Set the method used in transformation.
        Parameters:
        newMethod - the index of method to use.
      • getTransformMethod

        public SelectedTag getTransformMethod()
        Get the method used in transformation.
        Returns:
        the index of method used.
      • transform

        public Instances transform​(Instances train)
                            throws java.lang.Exception
        Implements MITransform (3 type of transformation) 1.arithmatic average; 2.geometric centor; 3.merge minima and maxima attribute value together
        Parameters:
        train - the multi-instance dataset (with relational attribute)
        Returns:
        the transformed dataset with each bag contain mono-instance (without relational attribute) so that any classifier not for MI dataset can be applied on it.
        Throws:
        java.lang.Exception - if the transformation fails
      • minimax

        public static double[] minimax​(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​(Instances train)
                             throws java.lang.Exception
        Builds the classifier
        Specified by:
        buildClassifier in class Classifier
        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
      • distributionForInstance

        public double[] distributionForInstance​(Instance newBag)
                                         throws java.lang.Exception
        Computes the distribution for a given exemplar
        Overrides:
        distributionForInstance in class Classifier
        Parameters:
        newBag - 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)