probabilityMachine
Class VPMSimpleTypeDistMetaLearner

java.lang.Object
  |
  +--weka.classifiers.Classifier
        |
        +--probabilityMachine.VennProbabilityClassifier
              |
              +--probabilityMachine.VPMSimpleTypeDistMetaLearner
All Implemented Interfaces:
java.lang.Cloneable, OptionHandler, java.io.Serializable

public class VPMSimpleTypeDistMetaLearner
extends VennProbabilityClassifier
implements OptionHandler

The first implementation of a VPM Distribution Classifier Meta Learner. Uses Gaussians to model types!

Version:
$Revision: 1.0 $
Author:
David Lindsay (davidl@cs.rhul.ac.uk)
See Also:
Serialized Form

Constructor Summary
VPMSimpleTypeDistMetaLearner()
          The amazing VPMBartsRMI classifier
VPMSimpleTypeDistMetaLearner(int vennt)
          The amazing VPMSimpleTypeDistMetaLearner classifier, used to show how to adapt a classifer to the VPM meta learning framework!
 
Method Summary
 void buildClassifier(Instances instances)
          Generates the classifier.
 java.lang.String[] calculateTypesForExamples(Instances train, Instances[] classPreds, int[][] predLabelArray)
          This function will calculate the types for each example using the Gaussians calculated above.
 java.lang.String createTypeDetailString(int[] closestGaussianVennType, int[] typeDetails, int classAssigned)
          Output type membership details
 int getNumberVennTypes()
          Gets the number of Venn probability types used!
 boolean getOptimizeBins()
          Returns whether bin optimisation is switched on.
 java.lang.String[] getOptions()
          Gets the current settings of VPM.
 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 printArray(int[] array)
          Debugging function
 java.lang.String printArray(java.lang.String[] array)
          Debugging function
 void setNumberVennTypes(int vennt)
          Sets the number of Venn probability types used!
 void setOptimizeBins(boolean optBin)
          Switches bin optimisation on.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 java.lang.String toString()
          Returns a description of this classifier.
 Matrix vennProbsForInstance(Instance instance)
          Returns the Venn probability matrix for a given test instance.
 
Methods inherited from class probabilityMachine.VennProbabilityClassifier
classifyInstance, computeRowOfVPMMatrix, distributionForInstance, printArray, returnDistribution, returnUpperAndLowerProbability
 
Methods inherited from class weka.classifiers.Classifier
debugTipText, forName, getDebug, makeCopies, setDebug
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VPMSimpleTypeDistMetaLearner

public VPMSimpleTypeDistMetaLearner(int vennt)
The amazing VPMSimpleTypeDistMetaLearner classifier, used to show how to adapt a classifer to the VPM meta learning framework!

The options for this wonderful algorithm are as follows:
-y num Max number of Venn types
Sets the number of types used for the VPM

-W classifier name
Specify the name of the distribution classifier name that you wish to specify -u Optimise bins
Optimise number of bins using leave one out entropy.

Parameters:
vennt - the number of Venn probability types used

VPMSimpleTypeDistMetaLearner

public VPMSimpleTypeDistMetaLearner()
The amazing VPMBartsRMI classifier

Method Detail

setNumberVennTypes

public void setNumberVennTypes(int vennt)
Sets the number of Venn probability types used!


getNumberVennTypes

public int getNumberVennTypes()
Gets the number of Venn probability types used!


setOptimizeBins

public void setOptimizeBins(boolean optBin)
Switches bin optimisation on.


getOptimizeBins

public boolean getOptimizeBins()
Returns whether bin optimisation is switched on.


buildClassifier

public void buildClassifier(Instances instances)
                     throws java.lang.Exception
Generates the classifier.

Specified by:
buildClassifier in class Classifier
Parameters:
instances - set of instances serving as training data
Throws:
java.lang.Exception - if the classifier has not been generated successfully

listOptions

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

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

-y num Venn types
Sets the number of types used for the VPM

-W classifier name
Specify the name of the distribution classifier name that you wish to specify -u Optimise bins
Optimise number of bins using leave one out entropy.

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class Classifier
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 VPM.

Specified by:
getOptions in interface OptionHandler
Overrides:
getOptions in class Classifier
Returns:
an array of strings suitable for passing to setOptions()

calculateTypesForExamples

public java.lang.String[] calculateTypesForExamples(Instances train,
                                                    Instances[] classPreds,
                                                    int[][] predLabelArray)
                                             throws java.lang.Exception
This function will calculate the types for each example using the Gaussians calculated above.

Parameters:
train - this is the training data
predLabelArray - this is a horrible hack to allow discretization of predictions of each class label
Returns:
the type definitions for each example
java.lang.Exception

vennProbsForInstance

public Matrix vennProbsForInstance(Instance instance)
                            throws java.lang.Exception
Returns the Venn probability matrix for a given test instance.

Specified by:
vennProbsForInstance in class VennProbabilityClassifier
Parameters:
instance - the instance to be classified
Returns:
the Venn probability matrix
Throws:
java.lang.Exception - no training instances

printArray

public java.lang.String printArray(java.lang.String[] array)
Debugging function


printArray

public java.lang.String printArray(int[] array)
Debugging function

Overrides:
printArray in class VennProbabilityClassifier

createTypeDetailString

public java.lang.String createTypeDetailString(int[] closestGaussianVennType,
                                               int[] typeDetails,
                                               int classAssigned)
Output type membership details


toString

public java.lang.String toString()
Returns a description of this classifier.

Overrides:
toString in class java.lang.Object
Returns:
a description of this classifier as a string.

main

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

Parameters:
argv - should contain command line arguments for evaluation (see Evaluation).


Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London