All Packages Class Hierarchy This Package Previous Next Index WEKA's home
Class weka.classifiers.RegressionByDiscretization
java.lang.Object
|
+----weka.classifiers.Classifier
|
+----weka.classifiers.RegressionByDiscretization
- public class RegressionByDiscretization
- extends Classifier
- implements OptionHandler, WeightedInstancesHandler
Class for a regression scheme that employs any distribution
classifier on a copy of the data that has the class attribute
discretized. The predicted value is the expected value of the
mean class value for each discretized interval (based on the
predicted probabilities for each interval).
Valid options are:
-D
Produce debugging output.
-W classname
Specify the full class name of a classifier as the basis for
regression (required).
-B num
The number of bins the class attribute will be discretized into.
(default 10)
-O
Optimize number of bins (values up to and including the -B option will
be considered). (default no debugging output)
Any options after -- will be passed to the sub-classifier.
- Version:
- $Revision: 1.5 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz)
-
RegressionByDiscretization()
-
-
buildClassifier(Instances)
- Generates the classifier.
-
classifyInstance(Instance)
- Returns a predicted class for the test instance.
-
getClassifier()
- Get the classifier used as the classifier
-
getDebug()
- Gets whether debugging output will be printed
-
getNumBins()
- Gets the number of bins the class attribute will be discretized into.
-
getOptimizeBins()
- Gets whether the discretizer optimizes the number of bins
-
getOptions()
- Gets the current settings of the Classifier.
-
listOptions()
- Returns an enumeration describing the available options
-
main(String[])
- Main method for testing this class.
-
setClassifier(Classifier)
- Set the classifier for boosting.
-
setDebug(boolean)
- Sets whether debugging output will be printed
-
setNumBins(int)
- Sets the number of bins the class attribute will be discretized into.
-
setOptimizeBins(boolean)
- Sets whether the discretizer optimizes the number of bins
-
setOptions(String[])
- Parses a given list of options.
-
toString()
- Returns a description of the classifier.
RegressionByDiscretization
public RegressionByDiscretization()
buildClassifier
public void buildClassifier(Instances instances) throws Exception
- Generates the classifier.
- Parameters:
- instances - set of instances serving as training data
- Throws: Exception
- if the classifier has not been generated successfully
- Overrides:
- buildClassifier in class Classifier
classifyInstance
public double classifyInstance(Instance instance) throws Exception
- Returns a predicted class for the test instance.
- Parameters:
- instance - the instance to be classified
- Returns:
- predicted class value
- Throws: Exception
- if the prediction couldn't be made
- Overrides:
- classifyInstance in class Classifier
listOptions
public Enumeration listOptions()
- Returns an enumeration describing the available options
- Returns:
- an enumeration of all the available options
setOptions
public void setOptions(String options[]) throws Exception
- Parses a given list of options. Valid options are:
-D
Produce debugging output.
-W classname
Specify the full class name of a classifier as the basis for
regression (required).
-B num
The number of bins the class attribute will be discretized into.
(default 10)
-O
Optimize number of bins (values up to and including the -B option will
be considered). (default no debugging output)
Any options after -- will be passed to the sub-classifier.
- Parameters:
- options - the list of options as an array of strings
- Throws: Exception
- if an option is not supported
getOptions
public String[] getOptions()
- Gets the current settings of the Classifier.
- Returns:
- an array of strings suitable for passing to setOptions
setClassifier
public void setClassifier(Classifier newClassifier)
- Set the classifier for boosting.
- Parameters:
- newClassifier - the Classifier to use.
getClassifier
public Classifier getClassifier()
- Get the classifier used as the classifier
- Returns:
- the classifier used as the classifier
setOptimizeBins
public void setOptimizeBins(boolean optimize)
- Sets whether the discretizer optimizes the number of bins
- Parameters:
- optimize - true if the discretizer should optimize the number of bins
getOptimizeBins
public boolean getOptimizeBins()
- Gets whether the discretizer optimizes the number of bins
- Returns:
- true if the discretizer should optimize the number of bins
setDebug
public void setDebug(boolean debug)
- Sets whether debugging output will be printed
- Parameters:
- debug - true if debug output should be printed
getDebug
public boolean getDebug()
- Gets whether debugging output will be printed
- Returns:
- true if debug output should be printed
setNumBins
public void setNumBins(int numBins)
- Sets the number of bins the class attribute will be discretized into.
- Parameters:
- numBins - the number of bins to use
getNumBins
public int getNumBins()
- Gets the number of bins the class attribute will be discretized into.
- Returns:
- the number of bins to use
toString
public String toString()
- Returns a description of the classifier.
- Returns:
- a description of the classifier as a string.
- Overrides:
- toString in class Object
main
public static void main(String argv[])
- Main method for testing this class.
- Parameters:
- argv - the options
All Packages Class Hierarchy This Package Previous Next Index WEKA's home