public class PolynomialRegression extends BaseRegression
f(x,y,z) = a + b * x + c * x2 + d * y + e * y2 + ...Usage: <Order> [-print_accuracy <figs>]
| Modifier and Type | Field and Description |
|---|---|
protected double[] |
coefficients
Coefficients of each term in the polynomial
|
protected int |
Order
Desired Order of polynomial
|
AttributeSelector, trained, TrainingStats, validated, ValidationStats| Constructor and Description |
|---|
PolynomialRegression() |
| Modifier and Type | Method and Description |
|---|---|
PolynomialRegression |
clone() |
static double[][] |
expandAttributes(double[][] attributes,
int order)
Expand attribute array in order to allow it to be used to fit a polynomial
model.
|
static double[] |
fitPolynomialModel(double[][] attributes,
int order,
double[] classVariable)
Fit a polynomial model based on a matrix of attribute values.
|
double[] |
getCoefficients()
Get coefficients of model.
|
int |
getNFittingParameters()
Number of fitting parameters in a model.
|
protected java.lang.String |
printModel_protected()
Internal method that handles printing the model as a string.
|
java.util.List<java.lang.String> |
printModelDescriptionDetails(boolean htmlFormat)
Print details of the model.
|
java.lang.String |
printUsage()
Print out required format for options.
|
void |
run_protected(Dataset TrainData)
Run a model without checking if stuff is trained (use carefully)
|
static double[] |
runPolynomialModel(double[][] attributes,
int order,
double[] coefficients)
Run a polynomial model based on a matrix of attribute values.
|
void |
setOptions(java.util.List Options)
Set any options for this object.
|
void |
setOrder(int order)
Define Order of polynomial.
|
void |
setPrintAccuracy(int digits)
Set the number of digits printed when outputting model
|
protected void |
train_protected(Dataset TrainData)
Train a model without evaluating performance
|
doRobustRegression, getRobustRegressionQ, robustTraining, runCommand, setRobustRegressionQabout, crossValidate, crossValidate, crossValidate, done, externallyValidate, getAttributeSelector, getCitations, getFilter, getTrainTime, getValidationMethod, handleSetCommand, isTrained, isValidated, loadState, printCommand, printDescription, printModel, resetModel, run, saveCommand, saveState, setAttributeSelector, setComponent, setFilter, train, trainprotected int Order
protected double[] coefficients
public void setOptions(java.util.List Options)
throws java.lang.Exception
OptionsOptions - Array of options as Objects - can be nulljava.lang.Exception - if problem with inputspublic PolynomialRegression clone()
clone in class BaseRegressionpublic java.lang.String printUsage()
Optionspublic void setOrder(int order)
order - Desired Order of polynomial.public void setPrintAccuracy(int digits)
digits - Number of significant figurespublic double[] getCoefficients()
protected void train_protected(Dataset TrainData)
BaseModeltrain_protected in class BaseModelTrainData - Training datapublic void run_protected(Dataset TrainData)
BaseModelrun_protected in class BaseModelTrainData - Training datapublic int getNFittingParameters()
AbstractRegressionModelpublic static double[] fitPolynomialModel(double[][] attributes,
int order,
double[] classVariable)
Intercept, Coefficient of attribute1, Coefficient of attribute12, ..., Coefficient of attribute2, ...
attributes - Matrix containing attributes for each entry (entries are rows, attributes columns)order - Desired Order of polynomialclassVariable - Class variable for each entrypublic static double[][] expandAttributes(double[][] attributes,
int order)
attributes - Matrix containing attributes for each entry (entries are rows, attributes columns)order - Desired order of polynomialpublic static double[] runPolynomialModel(double[][] attributes,
int order,
double[] coefficients)
Intercept, Coefficient of attribute1, Coefficient of attribute12, ..., Coefficient of attribute2, ...
attributes - Matrix containing attributes for each entry (entries are rows, attributes columns)order - Desired order of polynomialcoefficients - Coefficients of polynomial modelprotected java.lang.String printModel_protected()
BaseModelprintModel_protected in class BaseModelpublic java.util.List<java.lang.String> printModelDescriptionDetails(boolean htmlFormat)
BaseModelBaseModel.printDescription(boolean).
Implementation note: No not add indentation for details. That is handled
by BaseModel.printDescription(boolean). You should also call the super
operation to get the Normalizer and Attribute selector settings
printModelDescriptionDetails in class BaseModelhtmlFormat - Whether to use HTML format