probabilityMachine
Class VennProbabilityClassifier

java.lang.Object
  |
  +--weka.classifiers.Classifier
        |
        +--probabilityMachine.VennProbabilityClassifier
All Implemented Interfaces:
java.lang.Cloneable, OptionHandler, java.io.Serializable
Direct Known Subclasses:
VPMBartsRMI, VPMBartsRMI2, VPMDistMetaLearner, VPMKNearestNeighbours, VPMMDLEntropyTypeDistMetaLearner, VPMNaiveBayes, VPMSimpleTypeDistMetaLearner

public abstract class VennProbabilityClassifier
extends Classifier

Abstract classification model that produces (for each test instance) a valid probability estimation of the membership in each class.

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

Constructor Summary
VennProbabilityClassifier()
           
 
Method Summary
 double classifyInstance(Instance instance)
          Classifies the given test instance.
static void computeRowOfVPMMatrix(java.lang.String[] typeDefinitions, Matrix vpmMatrix, Instances trainingSet, Instance testExample)
          Counts the number of examples with the same type as the new example to create each row of the VPM matrix.
 double[] distributionForInstance(Instance instance)
          Returns a single distribution for an instance, by crudely averaging the Venn probabilities.
 java.lang.String printArray(double[] array)
          Debugging function
 java.lang.String printArray(int[] array)
          Debugging function
static double[] returnDistribution(Matrix vennProbs)
          Converts the Venn Probability Matrix into a distribution for each class
static double[] returnUpperAndLowerProbability(Matrix vennProbs)
          Calculates the upper and lower probabilities for the predicted label (a bit like a region prediction)
abstract  Matrix vennProbsForInstance(Instance instance)
          Predicts the Venn probabilities for each instance.
 
Methods inherited from class weka.classifiers.Classifier
buildClassifier, debugTipText, forName, getDebug, getOptions, listOptions, makeCopies, setDebug, setOptions
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VennProbabilityClassifier

public VennProbabilityClassifier()
Method Detail

vennProbsForInstance

public abstract Matrix vennProbsForInstance(Instance instance)
                                     throws java.lang.Exception
Predicts the Venn probabilities for each instance.

Parameters:
instance - the instance to be classified
Returns:
a |Y|x|Y| size array that gives the probability for each tentative classification tried.
Throws:
java.lang.Exception - if distribution could not be computed successfully

classifyInstance

public double classifyInstance(Instance instance)
                        throws java.lang.Exception
Classifies the given test instance. The instance has to belong to a dataset when it's being classified.

Overrides:
classifyInstance in class Classifier
Parameters:
instance - the instance to be classified
Returns:
the predicted most likely class for the instance or Instance.missingValue() if no prediction is made
Throws:
java.lang.Exception - if an error occurred during the prediction

distributionForInstance

public double[] distributionForInstance(Instance instance)
                                 throws java.lang.Exception
Returns a single distribution for an instance, by crudely averaging the Venn probabilities.

Overrides:
distributionForInstance in class Classifier
Parameters:
instance - the instance to be classified
Returns:
a probability estimate for each classification
Throws:
java.lang.Exception - if an error occurred during the prediction

returnDistribution

public static double[] returnDistribution(Matrix vennProbs)
                                   throws java.lang.Exception
Converts the Venn Probability Matrix into a distribution for each class

Parameters:
vennProbs - matrix containing the Venn probabilities
Returns:
the distribution for each class
java.lang.Exception

returnUpperAndLowerProbability

public static double[] returnUpperAndLowerProbability(Matrix vennProbs)
Calculates the upper and lower probabilities for the predicted label (a bit like a region prediction)

Parameters:
vennProbs - matrix containing the Venn probabilities
Returns:
the upper and lower probability for the instance

computeRowOfVPMMatrix

public static void computeRowOfVPMMatrix(java.lang.String[] typeDefinitions,
                                         Matrix vpmMatrix,
                                         Instances trainingSet,
                                         Instance testExample)
                                  throws java.lang.Exception
Counts the number of examples with the same type as the new example to create each row of the VPM matrix.

Parameters:
typeDefinitions - this contains the training types + new test example at the end.
vpmMatrix - the current VPM matrix, this will be updated in the function
java.lang.Exception

printArray

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


printArray

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



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