Package weka.classifiers.meta
Class MathExprClassRegressor
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.SingleClassifierEnhancer
-
- weka.classifiers.meta.MathExprClassRegressor
-
- All Implemented Interfaces:
Serializable,Cloneable,weka.classifiers.Classifier,weka.core.BatchPredictor,weka.core.CapabilitiesHandler,weka.core.CapabilitiesIgnorer,weka.core.CommandlineRunnable,weka.core.OptionHandler,weka.core.RevisionHandler
public class MathExprClassRegressor extends weka.classifiers.SingleClassifierEnhancerApplies the 'transform' expression to the class attribute in the data for training the based classifier and the 'inverse' expression at prediction time to convert the predicted class value back into input space.
Valid options are:-transform <expression> The expression to transform the class value. (default: log(1+X))
-inverse <expression> The expression to inverse transform the predicted class value. (default: exp(X)-1)
-W <classifier name> Full name of base classifier. (default: weka.classifiers.rules.ZeroR)
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
-batch-size The desired batch size for batch prediction (default 100).
Options specific to classifier weka.classifiers.rules.ZeroR:
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
-batch-size The desired batch size for batch prediction (default 100).
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringINVERSEprotected adams.parser.MathematicalExpressionTextm_Inversethe expression to inverse transform the class value.protected adams.parser.MathematicalExpressionTextm_Transformthe expression to transform the class value.static StringTRANSFORM
-
Constructor Summary
Constructors Constructor Description MathExprClassRegressor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildClassifier(weka.core.Instances data)Builds the classifier.doubleclassifyInstance(weka.core.Instance inst)Returns the prediction.adams.parser.MathematicalExpressionTextgetInverse()Get the mathematical expression for inverse transforming the class value for the base classifier.String[]getOptions()Gets the current settings of the classifier.StringgetRevision()Returns the revision string.adams.parser.MathematicalExpressionTextgetTransform()Get the mathematical expression for transforming the class value for the base classifier.StringglobalInfo()Returns a string describing classifier.protected doubleinverse(double x)Inverse transforms the value.StringinverseTipText()Returns the tip text for this property.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method for running this class.voidsetInverse(adams.parser.MathematicalExpressionText value)Set the mathematical expression for inverse transforming the class value for the base classifier.voidsetOptions(String[] options)Parses a given list of options.voidsetTransform(adams.parser.MathematicalExpressionText value)Set the mathematical expression for transforming the class value for the base classifier.StringtoString()Returns description of classifier.protected doubletransform(double x)Transforms the value.protected weka.core.Instancetransform(weka.core.Instance inst)Transforms the instance.StringtransformTipText()Returns the tip text for this property.-
Methods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, defaultClassifierOptions, defaultClassifierString, getCapabilities, getClassifier, getClassifierSpec, postExecution, preExecution, setClassifier
-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Field Detail
-
TRANSFORM
public static final String TRANSFORM
- See Also:
- Constant Field Values
-
INVERSE
public static final String INVERSE
- See Also:
- Constant Field Values
-
m_Transform
protected adams.parser.MathematicalExpressionText m_Transform
the expression to transform the class value.
-
m_Inverse
protected adams.parser.MathematicalExpressionText m_Inverse
the expression to inverse transform the class value.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing classifier.- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin classweka.classifiers.SingleClassifierEnhancer- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a given list of options.- Specified by:
setOptionsin interfaceweka.core.OptionHandler- Overrides:
setOptionsin classweka.classifiers.SingleClassifierEnhancer- 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.- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin classweka.classifiers.SingleClassifierEnhancer- Returns:
- an array of strings suitable for passing to setOptions
-
setTransform
public void setTransform(adams.parser.MathematicalExpressionText value)
Set the mathematical expression for transforming the class value for the base classifier.- Parameters:
value- the expression
-
getTransform
public adams.parser.MathematicalExpressionText getTransform()
Get the mathematical expression for transforming the class value for the base classifier.- Returns:
- the expression
-
transformTipText
public String transformTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setInverse
public void setInverse(adams.parser.MathematicalExpressionText value)
Set the mathematical expression for inverse transforming the class value for the base classifier.- Parameters:
value- the expression
-
getInverse
public adams.parser.MathematicalExpressionText getInverse()
Get the mathematical expression for inverse transforming the class value for the base classifier.- Returns:
- the expression
-
inverseTipText
public String inverseTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
transform
protected weka.core.Instance transform(weka.core.Instance inst) throws ExceptionTransforms the instance.- Parameters:
inst- the instance to transform- Returns:
- the transformed instance
- Throws:
Exception- if evaluation of formula fails
-
transform
protected double transform(double x) throws ExceptionTransforms the value.- Parameters:
x- the value to transform- Returns:
- the computed value
- Throws:
Exception- if evaluation of formula fails
-
inverse
protected double inverse(double x) throws ExceptionInverse transforms the value.- Parameters:
x- the value to inverse transform- Returns:
- the computed value
- Throws:
Exception- if evaluation of formula fails
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws ExceptionBuilds the classifier.- Parameters:
data- the training data- Throws:
Exception- if something goes wrong
-
classifyInstance
public double classifyInstance(weka.core.Instance inst) throws ExceptionReturns the prediction.- Specified by:
classifyInstancein interfaceweka.classifiers.Classifier- Overrides:
classifyInstancein classweka.classifiers.AbstractClassifier- Parameters:
inst- the instance to predict- Returns:
- the prediction
- Throws:
Exception- if prediction fails
-
toString
public String toString()
Returns description of classifier.
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceweka.core.RevisionHandler- Overrides:
getRevisionin classweka.classifiers.AbstractClassifier- Returns:
- the revision
-
main
public static void main(String[] args)
Main method for running this class.- Parameters:
args- the options
-
-