Package weka.classifiers.meta
Class RegressionByDiscretization
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.SingleClassifierEnhancer
weka.classifiers.meta.RegressionByDiscretization
- All Implemented Interfaces:
Serializable
,Cloneable
,CapabilitiesHandler
,OptionHandler
,RevisionHandler
A regression scheme that employs any classifier on a copy of the data that has the class attribute (equal-width) 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:
-B <int> Number of bins for equal-width discretization (default 10).
-E Whether to delete empty bins after discretization (default false).
-F Use equal-frequency instead of equal-width discretization.
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.trees.J48)
Options specific to classifier weka.classifiers.trees.J48:
-U Use unpruned tree.
-C <pruning confidence> Set confidence threshold for pruning. (default 0.25)
-M <minimum number of instances> Set minimum number of instances per leaf. (default 2)
-R Use reduced error pruning.
-N <number of folds> Set number of folds for reduced error pruning. One fold is used as pruning set. (default 3)
-B Use binary splits only.
-S Don't perform subtree raising.
-L Do not clean up after the tree has been built.
-A Laplace smoothing for predicted probabilities.
-Q <seed> Seed for random data shuffling (default 1).
- Version:
- $Revision: 4746 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz), Eibe Frank (eibe@cs.waikato.ac.nz)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildClassifier
(Instances instances) Generates the classifier.double
classifyInstance
(Instance instance) Returns a predicted class for the test instance.Returns the tip text for this propertyReturns default capabilities of the classifier.boolean
Gets the number of bins numeric attributes will be divided intoint
Gets the number of bins numeric attributes will be divided intoString[]
Gets the current settings of the Classifier.Returns the revision string.boolean
Get the value of UseEqualFrequency.Returns a string describing classifierReturns an enumeration describing the available options.static void
Main method for testing this class.Returns the tip text for this propertyvoid
setDeleteEmptyBins
(boolean b) Sets the number of bins to divide each selected numeric attribute intovoid
setNumBins
(int numBins) Sets the number of bins to divide each selected numeric attribute intovoid
setOptions
(String[] options) Parses a given list of options.void
setUseEqualFrequency
(boolean newUseEqualFrequency) Set the value of UseEqualFrequency.toString()
Returns a description of the classifier.Returns the tip text for this propertyMethods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, getClassifier, setClassifier
Methods inherited from class weka.classifiers.Classifier
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, setDebug
-
Constructor Details
-
RegressionByDiscretization
public RegressionByDiscretization()Default constructor.
-
-
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
- Overrides:
getCapabilities
in classSingleClassifierEnhancer
- Returns:
- the capabilities of this classifier
- See Also:
-
buildClassifier
Generates the classifier.- Specified by:
buildClassifier
in classClassifier
- Parameters:
instances
- set of instances serving as training data- Throws:
Exception
- if the classifier has not been generated successfully
-
classifyInstance
Returns a predicted class for the test instance.- Overrides:
classifyInstance
in classClassifier
- Parameters:
instance
- the instance to be classified- Returns:
- predicted class value
- Throws:
Exception
- if the prediction couldn't be made
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in classSingleClassifierEnhancer
- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-B <int> Number of bins for equal-width discretization (default 10).
-E Whether to delete empty bins after discretization (default false).
-F Use equal-frequency instead of equal-width discretization.
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.trees.J48)
Options specific to classifier weka.classifiers.trees.J48:
-U Use unpruned tree.
-C <pruning confidence> Set confidence threshold for pruning. (default 0.25)
-M <minimum number of instances> Set minimum number of instances per leaf. (default 2)
-R Use reduced error pruning.
-N <number of folds> Set number of folds for reduced error pruning. One fold is used as pruning set. (default 3)
-B Use binary splits only.
-S Don't perform subtree raising.
-L Do not clean up after the tree has been built.
-A Laplace smoothing for predicted probabilities.
-Q <seed> Seed for random data shuffling (default 1).
- Specified by:
setOptions
in interfaceOptionHandler
- Overrides:
setOptions
in classSingleClassifierEnhancer
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the Classifier.- Specified by:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classSingleClassifierEnhancer
- Returns:
- an array of strings suitable for passing to setOptions
-
numBinsTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getNumBins
public int getNumBins()Gets the number of bins numeric attributes will be divided into- Returns:
- the number of bins.
-
setNumBins
public void setNumBins(int numBins) Sets the number of bins to divide each selected numeric attribute into- Parameters:
numBins
- the number of bins
-
deleteEmptyBinsTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getDeleteEmptyBins
public boolean getDeleteEmptyBins()Gets the number of bins numeric attributes will be divided into- Returns:
- the number of bins.
-
setDeleteEmptyBins
public void setDeleteEmptyBins(boolean b) Sets the number of bins to divide each selected numeric attribute into- Parameters:
numBins
- the number of bins
-
useEqualFrequencyTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getUseEqualFrequency
public boolean getUseEqualFrequency()Get the value of UseEqualFrequency.- Returns:
- Value of UseEqualFrequency.
-
setUseEqualFrequency
public void setUseEqualFrequency(boolean newUseEqualFrequency) Set the value of UseEqualFrequency.- Parameters:
newUseEqualFrequency
- Value to assign to UseEqualFrequency.
-
toString
Returns a description of the classifier. -
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classClassifier
- Returns:
- the revision
-
main
Main method for testing this class.- Parameters:
argv
- the options
-