probabilityMachine.vpm
Class VPMBartsRMI2

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

public class VPMBartsRMI2
extends VennProbabilityClassifier
implements OptionHandler

The second VPM version of the BartsRMI algorithm. Uses Gaussians to model strangeness types! (Only for use on Ovarian Cancer data)

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

Constructor Summary
VPMBartsRMI2()
          The amazing VPMBartsRMI classifier
VPMBartsRMI2(double rmit, int vennt)
          The amazing VPMBartsRMI2 classifier, used to show how to adapt a classifer to the VPM meta learning framework!
 
Method Summary
 double[] addDoubleToEndOfArray(double[] array, double d)
           
 int assignVennType(double dist, int chosenGaussian)
          This is the function that sets the type depending on the number of deviations from the mean! (This need not be symmetric about the mean!)
 void buildClassifier(Instances instances)
          Generates the classifier.
 double calculateRMI(Instance instance)
          Calculates the Risk of Malignancy Index find ref ? (Jacobs et al)
 int[] countNumberInSameTypeAsNewTest(int[] closestGaussianVennType)
          Simple function to count the number of training examples of the same Venn type as the new test example.
 int[] createSymmetricVennTranslationVector()
          Creates a vector to work out how to translate identifier -> index
 java.lang.String createTypeDetailString(int[] closestGaussianVennType, int[] typeDetails, int classAssigned)
          Output type membership details
 int[] findVennTypes(double benignAlphaMean, double benignAlphaVar, double malignantAlphaMean, double malignantAlphaVar, double[] allAlphas, double alphaNew)
          Computes the Venn types for training and new test example
 int[] getGaussianStdTypes(int[] closestGaussianVennType, double benignAlphaMean, double benignAlphaVar, double malignantAlphaMean, double malignantAlphaVar, double[] allAlphas, double alphaNew)
          Finds the number of std deviations away from the mean of each Gaussian -ve represent in Benign Gaussian +ve represent in Malignant Gaussian.
 int getNumberVennTypes()
          Gets the number of Venn probability types used!
 java.lang.String[] getOptions()
          Gets the current settings of VPM.
 double getRMIThreshold()
          Gets the currently set RMI threshold
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options
 double mahanobolisDistanceFrom(double mean, double var, double x)
          Finds the number of standard deviations from the mean of a Gaussian
static void main(java.lang.String[] argv)
          Main method for testing this class.
 java.lang.String printArray(double[] array)
          Debugging function
 double probGaussian(double mean, double var, double x)
          Computes prob from a Gaussian!
 int[] setAsTrueGaussian(int chosenGaussianOfTest)
          Debugging class that sets the Gaussian to its true class
 void setNumberVennTypes(int vennt)
          Sets the number of Venn probability types used!
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setRMIThreshold(double rmit)
          Sets the RMI threshold
 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

VPMBartsRMI2

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

The options for this wonderful algorithm are as follows:
-r threshold
Set the threshold for the RMI (default: 250)

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

Parameters:
rmit - the RMI threshold
vennt - the number of Venn probability types used

VPMBartsRMI2

public VPMBartsRMI2()
The amazing VPMBartsRMI classifier

Method Detail

setRMIThreshold

public void setRMIThreshold(double rmit)
Sets the RMI threshold


getRMIThreshold

public double getRMIThreshold()
Gets the currently set RMI threshold


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!


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:

-r threshold
Set the threshold for the RMI (default: 250)

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

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()

calculateRMI

public double calculateRMI(Instance instance)
Calculates the Risk of Malignancy Index find ref ? (Jacobs et al)


addDoubleToEndOfArray

public double[] addDoubleToEndOfArray(double[] array,
                                      double d)

probGaussian

public double probGaussian(double mean,
                           double var,
                           double x)
Computes prob from a Gaussian!


findVennTypes

public int[] findVennTypes(double benignAlphaMean,
                           double benignAlphaVar,
                           double malignantAlphaMean,
                           double malignantAlphaVar,
                           double[] allAlphas,
                           double alphaNew)
Computes the Venn types for training and new test example


getGaussianStdTypes

public int[] getGaussianStdTypes(int[] closestGaussianVennType,
                                 double benignAlphaMean,
                                 double benignAlphaVar,
                                 double malignantAlphaMean,
                                 double malignantAlphaVar,
                                 double[] allAlphas,
                                 double alphaNew)
Finds the number of std deviations away from the mean of each Gaussian -ve represent in Benign Gaussian +ve represent in Malignant Gaussian. Determined by the user specified number of types. eg. If 3 types specified, +3 represents in outer tails (further than 3 stdevs from mean) of Malignant Gaussian! -2 represnts in bands between 2 and 3 stdevs of mean of Benign Gaussian


assignVennType

public int assignVennType(double dist,
                          int chosenGaussian)
This is the function that sets the type depending on the number of deviations from the mean! (This need not be symmetric about the mean!)


mahanobolisDistanceFrom

public double mahanobolisDistanceFrom(double mean,
                                      double var,
                                      double x)
Finds the number of standard deviations from the mean of a Gaussian


createSymmetricVennTranslationVector

public int[] createSymmetricVennTranslationVector()
Creates a vector to work out how to translate identifier -> index


countNumberInSameTypeAsNewTest

public int[] countNumberInSameTypeAsNewTest(int[] closestGaussianVennType)
Simple function to count the number of training examples of the same Venn type as the new test example.


setAsTrueGaussian

public int[] setAsTrueGaussian(int chosenGaussianOfTest)
Debugging class that sets the Gaussian to its true class


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(double[] 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