public class LASSORegression extends BaseRegression
For now, this uses Forward Stepwise Regression.
Usage: -maxterms <terms>
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.lang.Double> |
Coefficients
Coefficients for linear model
|
protected double |
Intercept
Intercept of the linear model
|
protected int |
MaxNumberTerms
Maximum number of features allowed in model (-1 is unlimited)
|
protected java.util.List<java.lang.String> |
TermNames
Names of terms used in the model
|
protected java.util.List<java.lang.Integer> |
Terms
Terms used in the model
|
AttributeSelector, trained, TrainingStats, validated, ValidationStats
Constructor and Description |
---|
LASSORegression() |
Modifier and Type | Method and Description |
---|---|
BaseRegression |
clone() |
protected int |
findMaxCorrelation(double[][] features,
double[] objective,
boolean[] isSearchable)
Finds the feature with the maximum correlation out of all possible candidates
|
static double |
getMAE(double[] residuals)
Get Mean Absolute Error (MAE) given residuals
|
int |
getNFittingParameters()
Number of fitting parameters in a model.
|
double[] |
getResidual(double[][] x,
double[] y)
Determines the residuals from a model
|
static double[] |
linearFit(double[] x,
double[] y,
boolean intercept)
Find the best linear fit
|
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)
|
double[] |
runModel(double[][] x)
Runs the model contained within object
|
void |
setMaxNumberTerms(int MaxNumberTerms) |
void |
setOptions(java.util.List OptionsObj)
Set any options for this object.
|
protected void |
train_protected(Dataset TrainData)
Train a model without evaluating performance
|
doRobustRegression, getRobustRegressionQ, robustTraining, runCommand, setRobustRegressionQ
about, crossValidate, externallyValidate, getAttributeSelector, getCitations, getFilter, getTrainTime, getValidationMethod, handleSetCommand, isTrained, isValidated, loadState, printCommand, printDescription, printModel, resetModel, run, saveCommand, saveState, setAttributeSelector, setComponent, setFilter, train, train
protected int MaxNumberTerms
protected java.util.List<java.lang.Integer> Terms
protected java.util.List<java.lang.String> TermNames
protected java.util.List<java.lang.Double> Coefficients
protected double Intercept
public BaseRegression clone()
clone
in class BaseRegression
public void setOptions(java.util.List OptionsObj) throws java.lang.Exception
Options
OptionsObj
- Array of options as Objects - can be null
java.lang.Exception
- if problem with inputspublic java.lang.String printUsage()
Options
public void setMaxNumberTerms(int MaxNumberTerms)
protected void train_protected(Dataset TrainData)
BaseModel
train_protected
in class BaseModel
TrainData
- Training datapublic int getNFittingParameters()
AbstractRegressionModel
public void run_protected(Dataset TrainData)
BaseModel
run_protected
in class BaseModel
TrainData
- Training dataprotected int findMaxCorrelation(double[][] features, double[] objective, boolean[] isSearchable)
features
- Features for each measurementobjective
- Objective function for each measurementisSearchable
- List of which features are searchablepublic static double[] linearFit(double[] x, double[] y, boolean intercept)
x
- Independent variabley
- Dependent variableintercept
- Whether to fit an interceptpublic double[] getResidual(double[][] x, double[] y)
x
- Observation matrixy
- Data to compare against modely - runModel(x)
public double[] runModel(double[][] x)
x
- Observation matrixpublic static double getMAE(double[] residuals)
residuals
- Error between model and reality for each entryprotected java.lang.String printModel_protected()
BaseModel
printModel_protected
in class BaseModel
public java.util.List<java.lang.String> printModelDescriptionDetails(boolean htmlFormat)
BaseModel
BaseModel.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 BaseModel
htmlFormat
- Whether to use HTML format