Package weka.classifiers.rules
Class ZeroR
java.lang.Object
weka.classifiers.AbstractClassifier
weka.classifiers.rules.ZeroR
- All Implemented Interfaces:
Serializable
,Cloneable
,Classifier
,Sourcable
,BatchPredictor
,CapabilitiesHandler
,CapabilitiesIgnorer
,CommandlineRunnable
,OptionHandler
,RevisionHandler
,WeightedInstancesHandler
Class for building and using a 0-R classifier.
Predicts the mean (for a numeric class) or the mode (for a nominal class).
Valid options are:
-D If set, classifier is run in debug mode and may output additional info to the console
- Version:
- $Revision: 12024 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz)
- See Also:
-
Field Summary
Fields inherited from class weka.classifiers.AbstractClassifier
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
buildClassifier
(Instances instances) Generates the classifier.double
classifyInstance
(Instance instance) Classifies a given instance.double[]
distributionForInstance
(Instance instance) Calculates the class membership probabilities for the given test instance.Returns default capabilities of the classifier.Returns the revision string.Returns a string describing classifierstatic void
Main method for testing this class.Returns a string that describes the classifier as source.toString()
Returns a description of the classifier.Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, getOptions, implementsMoreEfficientBatchPrediction, listOptions, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces, setOptions
-
Constructor Details
-
ZeroR
public ZeroR()
-
-
Method Details
-
globalInfo
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
getCapabilities
Returns default capabilities of the classifier.- Specified by:
getCapabilities
in interfaceCapabilitiesHandler
- Specified by:
getCapabilities
in interfaceClassifier
- Overrides:
getCapabilities
in classAbstractClassifier
- Returns:
- the capabilities of this classifier
- See Also:
-
buildClassifier
Generates the classifier.- Specified by:
buildClassifier
in interfaceClassifier
- Parameters:
instances
- set of instances serving as training data- Throws:
Exception
- if the classifier has not been generated successfully
-
classifyInstance
Classifies a given instance.- Specified by:
classifyInstance
in interfaceClassifier
- Overrides:
classifyInstance
in classAbstractClassifier
- Parameters:
instance
- the instance to be classified- Returns:
- index of the predicted class
-
distributionForInstance
Calculates the class membership probabilities for the given test instance.- Specified by:
distributionForInstance
in interfaceClassifier
- Overrides:
distributionForInstance
in classAbstractClassifier
- Parameters:
instance
- the instance to be classified- Returns:
- predicted class probability distribution
- Throws:
Exception
- if class is numeric
-
toSource
Returns a string that describes the classifier as source. The classifier will be contained in a class with the given name (there may be auxiliary classes), and will contain a method with the signature:public static double classify(Object[] i);
i
contains elements that are either Double, String, with missing values represented as null. The generated code is public domain and comes with no warranty. -
toString
Returns a description of the classifier. -
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classAbstractClassifier
- Returns:
- the revision
-
main
Main method for testing this class.- Parameters:
argv
- the options
-