Package weka.classifiers.functions
Class PaceRegression
- java.lang.Object
-
- weka.classifiers.Classifier
-
- weka.classifiers.functions.PaceRegression
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,CapabilitiesHandler
,OptionHandler
,RevisionHandler
,TechnicalInformationHandler
,WeightedInstancesHandler
public class PaceRegression extends Classifier implements OptionHandler, WeightedInstancesHandler, TechnicalInformationHandler
Class for building pace regression linear models and using them for prediction.
Under regularity conditions, pace regression is provably optimal when the number of coefficients tends to infinity. It consists of a group of estimators that are either overall optimal or optimal under certain conditions.
The current work of the pace regression theory, and therefore also this implementation, do not handle:
- missing values
- non-binary nominal attributes
- the case that n - k is small where n is the number of instances and k is the number of coefficients (the threshold used in this implmentation is 20)
For more information see:
Wang, Y (2000). A new approach to fitting linear models in high dimensional spaces. Hamilton, New Zealand.
Wang, Y., Witten, I. H.: Modeling for optimal probability prediction. In: Proceedings of the Nineteenth International Conference in Machine Learning, Sydney, Australia, 650-657, 2002. BibTeX:@phdthesis{Wang2000, address = {Hamilton, New Zealand}, author = {Wang, Y}, school = {Department of Computer Science, University of Waikato}, title = {A new approach to fitting linear models in high dimensional spaces}, year = {2000} } @inproceedings{Wang2002, address = {Sydney, Australia}, author = {Wang, Y. and Witten, I. H.}, booktitle = {Proceedings of the Nineteenth International Conference in Machine Learning}, pages = {650-657}, title = {Modeling for optimal probability prediction}, year = {2002} }
Valid options are:-D Produce debugging output. (default no debugging output)
-E <estimator> The estimator can be one of the following: eb -- Empirical Bayes estimator for noraml mixture (default) nested -- Optimal nested model selector for normal mixture subset -- Optimal subset selector for normal mixture pace2 -- PACE2 for Chi-square mixture pace4 -- PACE4 for Chi-square mixture pace6 -- PACE6 for Chi-square mixture ols -- Ordinary least squares estimator aic -- AIC estimator bic -- BIC estimator ric -- RIC estimator olsc -- Ordinary least squares subset selector with a threshold
-S <threshold value> Threshold value for the OLSC estimator
- Version:
- $Revision: 5523 $
- Author:
- Yong Wang (yongwang@cs.waikato.ac.nz), Gabi Schmidberger (gabi@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Tag[]
TAGS_ESTIMATOR
estimator types
-
Constructor Summary
Constructors Constructor Description PaceRegression()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildClassifier(Instances data)
Builds a pace regression model for the given data.boolean
checkForMissing(Instance instance, Instances model)
Checks if an instance has a missing value.double
classifyInstance(Instance instance)
Classifies the given instance using the linear regression function.double[]
coefficients()
Returns the coefficients for this linear model.java.lang.String
debugTipText()
Returns the tip text for this propertyjava.lang.String
estimatorTipText()
Returns the tip text for this propertyCapabilities
getCapabilities()
Returns default capabilities of the classifier.boolean
getDebug()
Controls whether debugging output will be printedSelectedTag
getEstimator()
Gets the estimatorjava.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.double
getThreshold()
Gets the threshold for olsc estimatorjava.lang.String
globalInfo()
Returns a string describing this classifierjava.util.Enumeration
listOptions()
Returns an enumeration describing the available options.static void
main(java.lang.String[] argv)
Generates a linear regression function predictor.int
numParameters()
Get the number of coefficients used in the modelvoid
setDebug(boolean debug)
Controls whether debugging output will be printedvoid
setEstimator(SelectedTag estimator)
Sets the estimator.void
setOptions(java.lang.String[] options)
Parses a given list of options.void
setThreshold(double newThreshold)
Set threshold for the olsc estimatorjava.lang.String
thresholdTipText()
Returns the tip text for this propertyjava.lang.String
toString()
Outputs the linear regression model as a string.-
Methods inherited from class weka.classifiers.Classifier
distributionForInstance, forName, makeCopies, makeCopy
-
-
-
-
Field Detail
-
TAGS_ESTIMATOR
public static final Tag[] TAGS_ESTIMATOR
estimator types
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing this classifier- Returns:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
public 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.- Specified by:
getTechnicalInformation
in interfaceTechnicalInformationHandler
- Returns:
- the technical information about this class
-
getCapabilities
public Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilities
in interfaceCapabilitiesHandler
- Overrides:
getCapabilities
in classClassifier
- Returns:
- the capabilities of this classifier
- See Also:
Capabilities
-
buildClassifier
public void buildClassifier(Instances data) throws java.lang.Exception
Builds a pace regression model for the given data.- Specified by:
buildClassifier
in classClassifier
- Parameters:
data
- the training data to be used for generating the linear regression function- Throws:
java.lang.Exception
- if the classifier could not be built successfully
-
checkForMissing
public boolean checkForMissing(Instance instance, Instances model)
Checks if an instance has a missing value.- Parameters:
instance
- the instancemodel
- the data- Returns:
- true if missing value is present
-
classifyInstance
public double classifyInstance(Instance instance) throws java.lang.Exception
Classifies the given instance using the linear regression function.- Overrides:
classifyInstance
in classClassifier
- Parameters:
instance
- the test instance- Returns:
- the classification
- Throws:
java.lang.Exception
- if classification can't be done successfully
-
toString
public java.lang.String toString()
Outputs the linear regression model as a string.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the model as string
-
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in classClassifier
- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.Exception
Parses a given list of options. Valid options are:-D Produce debugging output. (default no debugging output)
-E <estimator> The estimator can be one of the following: eb -- Empirical Bayes estimator for noraml mixture (default) nested -- Optimal nested model selector for normal mixture subset -- Optimal subset selector for normal mixture pace2 -- PACE2 for Chi-square mixture pace4 -- PACE4 for Chi-square mixture pace6 -- PACE6 for Chi-square mixture ols -- Ordinary least squares estimator aic -- AIC estimator bic -- BIC estimator ric -- RIC estimator olsc -- Ordinary least squares subset selector with a threshold
-S <threshold value> Threshold value for the OLSC estimator
- Specified by:
setOptions
in interfaceOptionHandler
- Overrides:
setOptions
in classClassifier
- Parameters:
options
- the list of options as an array of strings- Throws:
java.lang.Exception
- if an option is not supported
-
coefficients
public double[] coefficients()
Returns the coefficients for this linear model.- Returns:
- the coefficients for this linear model
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the classifier.- Specified by:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classClassifier
- Returns:
- an array of strings suitable for passing to setOptions
-
numParameters
public int numParameters()
Get the number of coefficients used in the model- Returns:
- the number of coefficients
-
debugTipText
public java.lang.String debugTipText()
Returns the tip text for this property- Overrides:
debugTipText
in classClassifier
- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setDebug
public void setDebug(boolean debug)
Controls whether debugging output will be printed- Overrides:
setDebug
in classClassifier
- Parameters:
debug
- true if debugging output should be printed
-
getDebug
public boolean getDebug()
Controls whether debugging output will be printed- Overrides:
getDebug
in classClassifier
- Returns:
- true if debugging output should be printed
-
estimatorTipText
public java.lang.String estimatorTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getEstimator
public SelectedTag getEstimator()
Gets the estimator- Returns:
- the estimator
-
setEstimator
public void setEstimator(SelectedTag estimator)
Sets the estimator.- Parameters:
estimator
- the new estimator
-
thresholdTipText
public java.lang.String thresholdTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setThreshold
public void setThreshold(double newThreshold)
Set threshold for the olsc estimator- Parameters:
newThreshold
- the threshold for the olsc estimator
-
getThreshold
public double getThreshold()
Gets the threshold for olsc estimator- Returns:
- the threshold
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classClassifier
- Returns:
- the revision
-
main
public static void main(java.lang.String[] argv)
Generates a linear regression function predictor.- Parameters:
argv
- the options
-
-