public class RegressionByDiscretization extends SingleClassifierEnhancer implements IntervalEstimator, ConditionalDensityEstimator
-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).
| Modifier and Type | Field and Description |
|---|---|
protected int[] |
m_ClassCounts
The class counts for each Discretized class interval.
|
protected double[] |
m_ClassMeans
The mean values for each Discretized class interval.
|
protected boolean |
m_DeleteEmptyBins
Whether to delete empty intervals.
|
protected Instances |
m_DiscretizedHeader
Header of discretized data.
|
protected Discretize |
m_Discretizer
The discretization filter.
|
protected UnivariateDensityEstimator |
m_Estimator
Which estimator to use (default: histogram)
|
protected boolean |
m_MinimizeAbsoluteError
Whether to minimize absolute error, rather than squared error.
|
protected int[] |
m_NewTargetValues
The converted target values in the training data
|
protected int |
m_NumBins
The number of discretization intervals.
|
protected int[] |
m_OldIndexToNewIndex
Mapping to convert indices in case empty bins are deleted.
|
protected double[] |
m_OriginalTargetValues
The original target values in the training data
|
protected boolean |
m_UseEqualFrequency
Use equal-frequency binning
|
m_ClassifierBATCH_SIZE_DEFAULT, m_BatchSize, m_Debug, m_DoNotCheckCapabilities, m_numDecimalPlaces, NUM_DECIMAL_PLACES_DEFAULT| Constructor and Description |
|---|
RegressionByDiscretization()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
buildClassifier(Instances instances)
Generates the classifier.
|
double |
classifyInstance(Instance instance)
Returns a predicted class for the test instance.
|
protected java.lang.String |
defaultClassifierString()
String describing default classifier.
|
java.lang.String |
deleteEmptyBinsTipText()
Returns the tip text for this property
|
java.lang.String |
estimatorTipText()
Returns the tip text for this property
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
boolean |
getDeleteEmptyBins()
Gets whether empty bins are deleted.
|
protected UnivariateDensityEstimator |
getDensityEstimator(Instance instance,
boolean print)
Get density estimator for given instance.
|
UnivariateDensityEstimator |
getEstimator()
Get the estimator
|
boolean |
getMinimizeAbsoluteError()
Gets whether to min. abs. error
|
int |
getNumBins()
Gets the number of bins numeric attributes will be divided into
|
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier.
|
java.lang.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.
|
boolean |
getUseEqualFrequency()
Get the value of UseEqualFrequency.
|
java.lang.String |
globalInfo()
Returns a string describing classifier
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
double |
logDensity(Instance instance,
double value)
Returns natural logarithm of density estimate for given value based on given instance.
|
static void |
main(java.lang.String[] argv)
Main method for testing this class.
|
java.lang.String |
minimizeAbsoluteErrorTipText()
Returns the tip text for this property
|
java.lang.String |
numBinsTipText()
Returns the tip text for this property
|
double[][] |
predictIntervals(Instance instance,
double confidenceLevel)
Returns an N * 2 array, where N is the number of prediction intervals.
|
void |
setDeleteEmptyBins(boolean b)
Sets whether to delete empty bins.
|
void |
setEstimator(UnivariateDensityEstimator estimator)
Set the estimator
|
void |
setMinimizeAbsoluteError(boolean b)
Sets whether to min. abs. error.
|
void |
setNumBins(int numBins)
Sets the number of bins to divide each selected numeric attribute into
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setUseEqualFrequency(boolean newUseEqualFrequency)
Set the value of UseEqualFrequency.
|
java.lang.String |
toString()
Returns a description of the classifier.
|
java.lang.String |
useEqualFrequencyTipText()
Returns the tip text for this property
|
classifierTipText, defaultClassifierOptions, getClassifier, getClassifierSpec, postExecution, preExecution, setClassifierbatchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlacesprotected Discretize m_Discretizer
protected int m_NumBins
protected double[] m_ClassMeans
protected int[] m_ClassCounts
protected boolean m_DeleteEmptyBins
protected int[] m_OldIndexToNewIndex
protected Instances m_DiscretizedHeader
protected boolean m_UseEqualFrequency
protected boolean m_MinimizeAbsoluteError
protected UnivariateDensityEstimator m_Estimator
protected double[] m_OriginalTargetValues
protected int[] m_NewTargetValues
public RegressionByDiscretization()
public java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
protected java.lang.String defaultClassifierString()
defaultClassifierString in class SingleClassifierEnhancerpublic Capabilities getCapabilities()
getCapabilities in interface ClassifiergetCapabilities in interface CapabilitiesHandlergetCapabilities in class SingleClassifierEnhancerCapabilitiespublic void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier in interface Classifierinstances - set of instances serving as training datajava.lang.Exception - if the classifier has not been generated successfullyprotected UnivariateDensityEstimator getDensityEstimator(Instance instance, boolean print) throws java.lang.Exception
inst - the instancejava.lang.Exception - if the estimator can't be computedpublic double[][] predictIntervals(Instance instance, double confidenceLevel) throws java.lang.Exception
predictIntervals in interface IntervalEstimatorinst - the instance to make the prediction for.confidenceLevel - the percentage of cases that the interval should cover.java.lang.Exception - if the intervals can't be computedpublic double logDensity(Instance instance, double value) throws java.lang.Exception
logDensity in interface ConditionalDensityEstimatorinst - the instance to make the prediction for.the - value to make the prediction for.java.lang.Exception - if the intervals can't be computedpublic double classifyInstance(Instance instance) throws java.lang.Exception
classifyInstance in interface ClassifierclassifyInstance in class AbstractClassifierinstance - the instance to be classifiedjava.lang.Exception - if the prediction couldn't be madepublic java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class SingleClassifierEnhancerpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
setOptions in interface OptionHandlersetOptions in class SingleClassifierEnhanceroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class SingleClassifierEnhancerpublic java.lang.String numBinsTipText()
public int getNumBins()
public void setNumBins(int numBins)
numBins - the number of binspublic java.lang.String deleteEmptyBinsTipText()
public boolean getDeleteEmptyBins()
public void setDeleteEmptyBins(boolean b)
b - if true, empty bins will be deletedpublic java.lang.String minimizeAbsoluteErrorTipText()
public boolean getMinimizeAbsoluteError()
public void setMinimizeAbsoluteError(boolean b)
b - if true, abs. err. is minimizedpublic java.lang.String useEqualFrequencyTipText()
public boolean getUseEqualFrequency()
public void setUseEqualFrequency(boolean newUseEqualFrequency)
newUseEqualFrequency - Value to assign to UseEqualFrequency.public java.lang.String estimatorTipText()
public UnivariateDensityEstimator getEstimator()
public void setEstimator(UnivariateDensityEstimator estimator)
newEstimator - the estimator to usepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class AbstractClassifierpublic static void main(java.lang.String[] argv)
argv - the options