|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.DistributionClassifier
weka.classifiers.meta.DistributionMetaClassifier
Class for wrapping a Classifier to make it return a distribution. Simply outputs a probabiltry of 1 for the predicted class and 0 for the others.
Constructor Summary | |
DistributionMetaClassifier()
Default constructor. |
|
DistributionMetaClassifier(Classifier toWrap)
Contructs a DistributionMetaClassifier wrapping a given Classifier. |
Method Summary | |
void |
buildClassifier(Instances data)
Builds a classifier for a set of instances. |
double[] |
distributionForInstance(Instance instance)
Returns the class probability distribution for an instance. |
Classifier |
getClassifier()
Gets the classifier being wrapped. |
java.lang.String[] |
getOptions()
Gets the current settings of the classifier. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options.. |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
void |
setClassifier(Classifier toWrap)
Sets the classifier to wrap. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
java.lang.String |
toString()
Returns a description of the classifier. |
Methods inherited from class weka.classifiers.DistributionClassifier |
calculateEntropy, calculateLabeledInstanceMargin, calculateMargin, classifyInstance |
Methods inherited from class weka.classifiers.Classifier |
forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DistributionMetaClassifier()
public DistributionMetaClassifier(Classifier toWrap)
toWrap
- the classifier to wrap aroundMethod Detail |
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- set of instances serving as training data
java.lang.Exception
- if the classifier hasn't been set or something goes wrongpublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class DistributionClassifier
instance
- the instance to be classified
java.lang.Exception
- if distribution could not be
computed successfullypublic java.lang.String toString()
public void setClassifier(Classifier toWrap)
toWrap
- the classifierpublic Classifier getClassifier()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-W classifier name
Classifier to wrap. (required)
setOptions
in interface OptionHandler
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
public static void main(java.lang.String[] argv)
argv
- the options
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |