public class CompositeRegression extends BaseRegression implements MultiModel
Has the ability to return the variance in predictions between submodels, which
can be used as a measure of their composite reliability.
Usage: *No options to set*
Implemented Commands:
submodel - Print the number of submodels submodel set generic $<model> - Define a model template to use for all submodels
submodel set <number> $<model - Set a specific submodel
<output> = submodel get generic - Retrieve the template for any unassigned submodels <output = submodel get <number> - Retrieve a specific submodel
Modifier and Type | Field and Description |
---|---|
BaseRegression |
GenericModel
Generic composite regression model (use wisely)
|
java.util.List<BaseRegression> |
Model
Collections of models used by this class
|
AttributeSelector, trained, TrainingStats, validated, ValidationStats
Constructor and Description |
---|
CompositeRegression() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkStatus() |
CompositeRegression |
clone() |
double[] |
getEnsembleMean(Dataset Data)
Get mean prediction by the ensemble for each entry
|
double[] |
getEnsembleMean(double[][] EnsemblePredictions)
Get mean prediction by the ensemble for each entry
|
double[][] |
getEnsemblePredictions(Dataset Data)
Calculate the predicted class using each model
|
double[] |
getEnsembleVariation(Dataset Data)
Return the variance in predictions for each entry.
|
double[] |
getEnsembleVariation(double[][] EnsemblePredictions)
Return the variance in predictions for each entry.
|
BaseRegression |
getGenericModel()
Get the model template
|
BaseModel |
getModel(int index)
Get a specific submodel.
|
int |
getNFittingParameters()
Number of fitting parameters in a model.
|
int |
NModels()
Get the number of models in ensemble
|
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 TestData)
Run a model without checking if stuff is trained (use carefully)
|
java.lang.Object |
runCommand(java.util.List<java.lang.Object> Command)
Process some command described by a list of Objects.
|
void |
setGenericModel(BaseModel x)
Set the model template
|
void |
setModel(int index,
BaseModel x)
Set a specific submodel.
|
void |
setNumberOfModels(int n)
Defines the number of models to be trained.
|
void |
setOptions(java.util.List Options)
Set any options for this object.
|
protected void |
train_protected(Dataset TrainData)
Train a model without evaluating performance
|
doRobustRegression, getRobustRegressionQ, robustTraining, setRobustRegressionQ
about, 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, train
public java.util.List<BaseRegression> Model
public BaseRegression GenericModel
public void setOptions(java.util.List Options) throws java.lang.Exception
Options
setOptions
in interface Options
Options
- Array of options as Objects - can be null
java.lang.Exception
- if problem with inputspublic java.lang.String printUsage()
Options
printUsage
in interface Options
public BaseModel getModel(int index)
MultiModel
getModel
in interface MultiModel
index
- Model to retrievepublic int NModels()
NModels
in interface MultiModel
public void setNumberOfModels(int n)
MultiModel
setNumberOfModels
in interface MultiModel
n
- Number of models to usepublic void setGenericModel(BaseModel x)
MultiModel
setGenericModel
in interface MultiModel
x
- Template model (will be cloned)public BaseRegression getGenericModel()
MultiModel
getGenericModel
in interface MultiModel
public void setModel(int index, BaseModel x)
MultiModel
Any implementation should not clone the model. This will allow people to construct a model used already-trained models.
setModel
in interface MultiModel
index
- Index of submodel to be setx
- Model to be used (creates a clone)protected void checkStatus()
public CompositeRegression clone()
clone
in class BaseRegression
protected void train_protected(Dataset TrainData)
BaseModel
train_protected
in class BaseModel
TrainData
- Training datapublic int getNFittingParameters()
AbstractRegressionModel
getNFittingParameters
in interface AbstractRegressionModel
public void run_protected(Dataset TestData)
BaseModel
run_protected
in class BaseModel
TestData
- Training datapublic double[][] getEnsemblePredictions(Dataset Data)
Data
- Dataset to be evaluatedpublic double[] getEnsembleMean(double[][] EnsemblePredictions)
EnsemblePredictions
- array produced using getEnsemblePredictions
public double[] getEnsembleMean(Dataset Data)
Double
- Dataset to be evaluatedpublic double[] getEnsembleVariation(double[][] EnsemblePredictions)
EnsemblePredictions
- Double array produced using getEnsemblePredictions
public double[] getEnsembleVariation(Dataset Data)
Data
- Dataset to evaluatepublic 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 formatpublic java.lang.Object runCommand(java.util.List<java.lang.Object> Command) throws java.lang.Exception
Commandable
runCommand
in interface Commandable
runCommand
in class BaseRegression
Command
- Command as a list of objectsjava.lang.Exception
- If something goes wrong