All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.OneR

java.lang.Object
   |
   +----weka.classifiers.Classifier
           |
           +----weka.classifiers.OneR

public class OneR
extends Classifier
implements OptionHandler
Class for building and using a 1R classifier. For more information, see

R.C. Holte (1993). Very simple classification rules perform well on most commonly used datasets. Machine Learning, Vol. 11, pp. 63-91.

Valid options are:

-B num
Specify the minimum number of objects in a bucket (default: 6).

Version:
$Revision: 1.8 $
Author:
Ian H. Witten (ihw@cs.waikato.ac.nz)

Constructor Index

 o OneR()

Method Index

 o buildClassifier(Instances)
Generates the classifier.
 o classifyInstance(Instance)
Classifies a given instance.
 o getMinBucketSize()
Get the value of minBucketSize.
 o getOptions()
Gets the current settings of the OneR classifier.
 o listOptions()
Returns an enumeration describing the available options.
 o main(String[])
Main method for testing this class
 o newNominalRule(Attribute, Instances, int[])
Create a rule branching on this nominal attribute.
 o newNumericRule(Attribute, Instances, int[])
Create a rule branching on this numeric attribute
 o newRule(Attribute, Instances)
Create a rule branching on this attribute.
 o setMinBucketSize(int)
Set the value of minBucketSize.
 o setOptions(String[])
Parses a given list of options.
 o toString()
Returns a description of the classifier

Constructors

 o OneR
 public OneR()

Methods

 o classifyInstance
 public double classifyInstance(Instance inst)
Classifies a given instance.

Parameters:
inst - the instance to be classified
Overrides:
classifyInstance in class Classifier
 o buildClassifier
 public void buildClassifier(Instances instances) throws Exception
Generates the classifier.

Parameters:
instances - the instances to be used for building the classifier
Throws: Exception
if the classifier can't be built successfully
Overrides:
buildClassifier in class Classifier
 o newRule
 public OneR. OneRRule newRule(Attribute attr,
                               Instances data) throws Exception
Create a rule branching on this attribute.

Parameters:
attr - the attribute to branch on
data - the data to be used for creating the rule
Throws: Exception
if the rule can't be built successfully
 o newNominalRule
 public OneR. OneRRule newNominalRule(Attribute attr,
                                      Instances data,
                                      int missingValueCounts[]) throws Exception
Create a rule branching on this nominal attribute.

Parameters:
attr - the attribute to branch on
data - the data to be used for creating the rule
missingValueCounts - to be filled in
Throws: Exception
if the rule can't be built successfully
 o newNumericRule
 public OneR. OneRRule newNumericRule(Attribute attr,
                                      Instances data,
                                      int missingValueCounts[]) throws Exception
Create a rule branching on this numeric attribute

Parameters:
attr - the attribute to branch on
data - the data to be used for creating the rule
missingValueCounts - to be filled in
Throws: Exception
if the rule can't be built successfully
 o listOptions
 public Enumeration listOptions()
Returns an enumeration describing the available options.

Returns:
an enumeration of all the available options
 o setOptions
 public void setOptions(String options[]) throws Exception
Parses a given list of options. Valid options are:

-B num
Specify the minimum number of objects in a bucket (default: 6).

Parameters:
options - the list of options as an array of strings
Throws: Exception
if an option is not supported
 o getOptions
 public String[] getOptions()
Gets the current settings of the OneR classifier.

Returns:
an array of strings suitable for passing to setOptions
 o toString
 public String toString()
Returns a description of the classifier

Overrides:
toString in class Object
 o getMinBucketSize
 public int getMinBucketSize()
Get the value of minBucketSize.

Returns:
Value of minBucketSize.
 o setMinBucketSize
 public void setMinBucketSize(int v)
Set the value of minBucketSize.

Parameters:
v - Value to assign to minBucketSize.
 o main
 public static void main(String argv[])
Main method for testing this class


All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home