|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.functions.PaceRegression
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 number of instances and k is
number of coefficients (the threshold used in this implmentation is 20)
Valid options are:
-D
Produce debugging output.
-E estimator
The estimator can be one of the following:
REFERENCES
Wang, Y. (2000). "A new approach to fitting linear models in high dimensional spaces." PhD Thesis. Department of Computer Science, University of Waikato, New Zealand.
Wang, Y. and Witten, I. H. (2002). "Modeling for optimal probability prediction." Proceedings of ICML'2002. Sydney.
Field Summary | |
private static int |
aicEstimator
|
private static int |
bicEstimator
|
private static int |
ebEstimator
|
private int |
m_ClassIndex
The index of the class attribute |
private double[] |
m_Coefficients
Array for storing coefficients of linear regression. |
private boolean |
m_Debug
True if debug output will be printed |
(package private) Instances |
m_Model
The model used |
private static int |
nestedEstimator
|
private static int |
olscEstimator
|
private double |
olscThreshold
|
private static int |
olsEstimator
|
private static int |
pace2Estimator
|
private static int |
pace4Estimator
|
private static int |
pace6Estimator
|
private int |
paceEstimator
|
private static int |
ricEstimator
|
private static int |
subsetEstimator
|
static Tag[] |
TAGS_ESTIMATOR
|
Constructor Summary | |
PaceRegression()
|
Method Summary | |
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. |
boolean |
checkForMissing(Instances data)
Checks if instances have a missing value. |
boolean |
checkForNonBinary(Instances data)
Checks if any of the nominal attributes is non-binary. |
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 property |
java.lang.String |
estimatorTipText()
Returns the tip text for this property |
boolean |
getDebug()
Controls whether debugging output will be printed |
SelectedTag |
getEstimator()
Gets the estimator |
java.lang.String[] |
getOptions()
Gets the current settings of the classifier. |
double |
getThreshold()
Gets the threshold for olsc estimator |
private double[][] |
getTransformedDataMatrix(Instances data,
int classIndex)
Transforms dataset into a two-dimensional array. |
java.lang.String |
globalInfo()
Returns a string describing this classifier |
java.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 model |
private double[] |
pace(double[][] matrix_X,
double[] vector_Y)
pace regression |
private double |
regressionPrediction(Instance transformedInstance,
double[] coefficients)
Calculate the dependent value for a given instance for a given regression model. |
void |
setDebug(boolean debug)
Controls whether debugging output will be printed |
void |
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 estimator |
java.lang.String |
thresholdTipText()
Returns the tip text for this property |
java.lang.String |
toString()
Outputs the linear regression model as a string. |
Methods inherited from class weka.classifiers.Classifier |
distributionForInstance, forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
Instances m_Model
private double[] m_Coefficients
private int m_ClassIndex
private boolean m_Debug
private static final int olsEstimator
private static final int ebEstimator
private static final int nestedEstimator
private static final int subsetEstimator
private static final int pace2Estimator
private static final int pace4Estimator
private static final int pace6Estimator
private static final int olscEstimator
private static final int aicEstimator
private static final int bicEstimator
private static final int ricEstimator
public static final Tag[] TAGS_ESTIMATOR
private int paceEstimator
private double olscThreshold
Constructor Detail |
public PaceRegression()
Method Detail |
public java.lang.String globalInfo()
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the training data to be used for generating the
linear regression function
java.lang.Exception
- if the classifier could not be built successfullyprivate double[] pace(double[][] matrix_X, double[] vector_Y)
matrix_X
- matrix with observationsvector_Y
- vektor with class values
java.lang.Exception
- if pace regression cannot be done successfullypublic boolean checkForMissing(Instances data)
data
- the data set
public boolean checkForMissing(Instance instance, Instances model)
instance
- the instance
public boolean checkForNonBinary(Instances data)
data
- the data set
private double[][] getTransformedDataMatrix(Instances data, int classIndex)
data
- datasetclassIndex
- index of the class attributepublic double classifyInstance(Instance instance) throws java.lang.Exception
classifyInstance
in class Classifier
instance
- the test instance
java.lang.Exception
- if classification can't be done successfullypublic java.lang.String toString()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic double[] coefficients()
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public int numParameters()
public java.lang.String debugTipText()
debugTipText
in class Classifier
public void setDebug(boolean debug)
setDebug
in class Classifier
debug
- true if debugging output should be printedpublic boolean getDebug()
getDebug
in class Classifier
public java.lang.String estimatorTipText()
public SelectedTag getEstimator()
public void setEstimator(SelectedTag estimator)
estimator
- the new estimatorpublic java.lang.String thresholdTipText()
public void setThreshold(double newThreshold)
public double getThreshold()
private double regressionPrediction(Instance transformedInstance, double[] coefficients) throws java.lang.Exception
transformedInstance
- the input instancecoefficients
- an array of coefficients for the regression
model
java.lang.Exception
- if the class attribute of the input instance
is not assignedpublic static void main(java.lang.String[] argv)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |