|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--confidenceMachine.ConfidenceClassifier | +--confidenceMachine.tcm.TCMKNearestNeighbours
The TCM K-Nearest Neighbours algorithm. With this particular implementation is embedded, meaning that the traditional K has been altered slightly to adapt a strangeness measure using a ratio of the K nearest distances to the predicted class and all other classes. For more information, see
Transductive Confidence Machines for Pattern Recognition, CRLC Technical Report
CRLC-TR-01-02, June 18 2001, Kostas Proedrou, Ilia Nouretdinov, Volodya Vovk,
Alex Gammerman
-Q Distance Metric
This is the distance metric that we are using (default Euclidean distance)
Constructor Summary | |
TCMKNearestNeighbours()
The amazing TCM K Nearest Neighbours classifier |
|
TCMKNearestNeighbours(int k)
The amazing TCM K Nearest Neighbours classifier |
Method Summary | |
void |
buildClassifier(Instances instances)
Generates the classifier. |
int |
getDebugEvery()
Reports whether the TCM is currently in debug mode (if not -1), and specifies how frequently to output message about TCM's progress on data. |
java.lang.String |
getDistanceMetric()
The gives details about the distance metric that has been chosen |
int |
getKNN()
Gets the number of neighbours the learner will use. |
java.lang.String[] |
getOptions()
Gets the current settings of TCM. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
double[] |
pValuesForInstance(Instance instance)
Returns the p-values for a given test instance. |
void |
setDebugEvery(int debug)
Set the TCM to debug its output, outputting progress as it goes along. |
boolean |
setDistanceMetric(java.lang.String distName,
java.lang.String[] distOptions)
Set the distance metric |
void |
setKNN(int k)
Set the number of neighbours the learner is to use. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
java.lang.String |
toString()
Returns a description of this classifier. |
void |
updateClassifier(Instance instance)
Updates the classifier. |
Methods inherited from class confidenceMachine.ConfidenceClassifier |
calculateConfidenceAndCredibility, calculatePValue, calculatePValue, classifyInstance, returnRegionPrediction |
Methods inherited from class weka.classifiers.Classifier |
debugTipText, distributionForInstance, forName, getDebug, makeCopies, setDebug |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TCMKNearestNeighbours(int k)
k
- the number of nearest neighbors to use for predictionpublic TCMKNearestNeighbours()
Method Detail |
public void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier
in class Classifier
instances
- set of instances serving as training data
java.lang.Exception
- if the classifier has not been generated successfullypublic void updateClassifier(Instance instance) throws java.lang.Exception
updateClassifier
in interface UpdateableClassifier
instance
- the instance to be put into the classifier
java.lang.Exception
- if the instance could not be included successfullypublic void setKNN(int k)
k
- the number of neighbours.public int getKNN()
public void setDebugEvery(int debug)
public int getDebugEvery()
public boolean setDistanceMetric(java.lang.String distName, java.lang.String[] distOptions)
distName
- the distance metric class name in fulldistOptions
- the options specified for that distance metric
public java.lang.String getDistanceMetric()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-K num
Set the number of nearest neighbors to use in prediction
(default 1)
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public double[] pValuesForInstance(Instance instance) throws java.lang.Exception
pValuesForInstance
in class ConfidenceClassifier
instance
- the instance to be classified
java.lang.Exception
- no training instancespublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv)
argv
- should contain command line arguments for evaluation
(see Evaluation).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London