|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
Abstract classifier. All schemes for numeric or nominal prediction in Weka extend this class. Note that a classifier MUST either implement distributionForInstance() or classifyInstance().
Field Summary | |
protected boolean |
m_Debug
Whether the classifier is run in debug mode. |
Constructor Summary | |
Classifier()
|
Method Summary | |
abstract void |
buildClassifier(Instances data)
Generates a classifier. |
double |
classifyInstance(Instance instance)
Classifies the given test instance. |
java.lang.String |
debugTipText()
Returns the tip text for this property |
double[] |
distributionForInstance(Instance instance)
Predicts the class memberships for a given instance. |
static Classifier |
forName(java.lang.String classifierName,
java.lang.String[] options)
Creates a new instance of a classifier given it's class name and (optional) arguments to pass to it's setOptions method. |
boolean |
getDebug()
Get whether debugging is turned on. |
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static Classifier[] |
makeCopies(Classifier model,
int num)
Creates copies of the current classifier, which can then be used for boosting etc. |
void |
setDebug(boolean debug)
Set debugging mode. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean m_Debug
Constructor Detail |
public Classifier()
Method Detail |
public abstract void buildClassifier(Instances data) throws java.lang.Exception
data
- set of instances serving as training data
java.lang.Exception
- if the classifier has not been
generated successfullypublic double classifyInstance(Instance instance) throws java.lang.Exception
instance
- the instance to be classified
java.lang.Exception
- if an error occurred during the predictionpublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
instance
- the instance to be classified
java.lang.Exception
- if distribution could not be
computed successfullypublic static Classifier forName(java.lang.String classifierName, java.lang.String[] options) throws java.lang.Exception
classifierName
- the fully qualified class name of the classifieroptions
- an array of options suitable for passing to setOptions. May
be null.
java.lang.Exception
- if the classifier name is invalid, or the options
supplied are not acceptable to the classifierpublic static Classifier[] makeCopies(Classifier model, int num) throws java.lang.Exception
model
- an example classifier to copynum
- the number of classifiers copies to create.
java.lang.Exception
- if an error occurspublic java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-D
If set, classifier is run in debug mode and
may output additional info to the console.
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 void setDebug(boolean debug)
debug
- true if debug output should be printedpublic boolean getDebug()
public java.lang.String debugTipText()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |