public class OneR extends AbstractClassifier implements TechnicalInformationHandler, Sourcable
@article{Holte1993, author = {R.C. Holte}, journal = {Machine Learning}, pages = {63-91}, title = {Very simple classification rules perform well on most commonly used datasets}, volume = {11}, year = {1993} }Valid options are:
-B <minimum bucket size> The minimum number of objects in a bucket (default: 6).
Constructor and Description |
---|
OneR() |
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(Instances instances)
Generates the classifier.
|
double |
classifyInstance(Instance inst)
Classifies a given instance.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
int |
getMinBucketSize()
Get the value of minBucketSize.
|
String[] |
getOptions()
Gets the current settings of the OneR classifier.
|
String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
String |
globalInfo()
Returns a string describing classifier
|
Enumeration |
listOptions()
Returns an enumeration describing the available options..
|
static void |
main(String[] argv)
Main method for testing this class
|
String |
minBucketSizeTipText()
Returns the tip text for this property
|
weka.classifiers.rules.OneR.OneRRule |
newNominalRule(Attribute attr,
Instances data,
int[] missingValueCounts)
Create a rule branching on this nominal attribute.
|
weka.classifiers.rules.OneR.OneRRule |
newNumericRule(Attribute attr,
Instances data,
int[] missingValueCounts)
Create a rule branching on this numeric attribute
|
weka.classifiers.rules.OneR.OneRRule |
newRule(Attribute attr,
Instances data)
Create a rule branching on this attribute.
|
void |
setMinBucketSize(int v)
Set the value of minBucketSize.
|
void |
setOptions(String[] options)
Parses a given list of options.
|
String |
toSource(String className)
Returns a string that describes the classifier as source.
|
String |
toString()
Returns a description of the classifier
|
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug
public String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public double classifyInstance(Instance inst) throws Exception
classifyInstance
in interface Classifier
classifyInstance
in class AbstractClassifier
inst
- the instance to be classifiedException
- if an error occurred during the predictionpublic Capabilities getCapabilities()
getCapabilities
in interface Classifier
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class AbstractClassifier
Capabilities
public void buildClassifier(Instances instances) throws Exception
buildClassifier
in interface Classifier
instances
- the instances to be used for building the classifierException
- if the classifier can't be built successfullypublic weka.classifiers.rules.OneR.OneRRule newRule(Attribute attr, Instances data) throws Exception
attr
- the attribute to branch ondata
- the data to be used for creating the ruleException
- if the rule can't be built successfullypublic weka.classifiers.rules.OneR.OneRRule newNominalRule(Attribute attr, Instances data, int[] missingValueCounts) throws Exception
attr
- the attribute to branch ondata
- the data to be used for creating the rulemissingValueCounts
- to be filled inException
- if the rule can't be built successfullypublic weka.classifiers.rules.OneR.OneRRule newNumericRule(Attribute attr, Instances data, int[] missingValueCounts) throws Exception
attr
- the attribute to branch ondata
- the data to be used for creating the rulemissingValueCounts
- to be filled inException
- if the rule can't be built successfullypublic Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class AbstractClassifier
public void setOptions(String[] options) throws Exception
-B <minimum bucket size> The minimum number of objects in a bucket (default: 6).
setOptions
in interface OptionHandler
setOptions
in class AbstractClassifier
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class AbstractClassifier
public String toSource(String className) throws Exception
public static double classify(Object[] i);
where the array 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.public String toString()
public String minBucketSizeTipText()
public int getMinBucketSize()
public void setMinBucketSize(int v)
v
- Value to assign to minBucketSize.public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class AbstractClassifier
public static void main(String[] argv)
argv
- the commandline optionsCopyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.