public abstract class SplitModel extends BaseModel implements MultiModel
How to Use a SplitModel
SplitModels work by first partitioning a Dataset using a BaseDatasetSplitter
and then training several models
Usage: *No options to set*
Implemented Commands:
splitter <method> [<options...>] - Define splitter used to partition dataset between models
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
submodel get generic = <output> - Retrieve the template for any unassigned submodels submodel get <number> = <output> - Retrieve a specific submodel
Implemented Print Commands:
splitter - Print out the name of splitter used by this model submodel - Print out number of submodels submodel <number> [<command...>] - Pass a print command to one of the submodels
Modifier and Type | Field and Description |
---|---|
protected BaseModel |
GenericModel
Model used to if a model template for a certain split is not defined
|
protected java.util.ArrayList<BaseModel> |
Model
List of of models used by this model
|
protected BaseDatasetSplitter |
Partitioner
Class used to partition data into similar groups
|
AttributeSelector, trained, TrainingStats, validated, ValidationStats
Constructor and Description |
---|
SplitModel() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkModelCount(int n)
Checks if enough models are defined.
|
SplitModel |
clone() |
java.util.List<org.apache.commons.lang3.tuple.Pair<java.lang.String,Citation>> |
getCitations()
Return a list of citations for this object and any underlying objects.
|
BaseModel |
getGenericModel()
Get the model template
|
BaseModel |
getModel(int index)
Get a specific submodel.
|
int |
NModels()
Returns the number of model slots currently available
|
java.lang.String |
printCommand(java.util.List<java.lang.String> Command)
Handles more complicated printing commands.
|
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 Data)
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.
|
void |
setPartitioner(BaseDatasetSplitter S)
Set the partitioner.
|
protected void |
train_protected(Dataset TrainingData)
Train a model without evaluating performance
|
about, crossValidate, crossValidate, crossValidate, done, externallyValidate, getAttributeSelector, getFilter, getTrainTime, getValidationMethod, handleSetCommand, isTrained, isValidated, loadState, printDescription, printModel, resetModel, run, saveCommand, saveState, setAttributeSelector, setComponent, setFilter, train, train
protected java.util.ArrayList<BaseModel> Model
protected BaseDatasetSplitter Partitioner
protected BaseModel GenericModel
public SplitModel clone()
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 void setNumberOfModels(int n)
MultiModel
setNumberOfModels
in interface MultiModel
n
- Number of models to usepublic int NModels()
NModels
in interface MultiModel
public BaseModel getGenericModel()
MultiModel
getGenericModel
in interface MultiModel
public void setGenericModel(BaseModel x)
setGenericModel
in interface MultiModel
x
- Template model (will be cloned)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)public void setPartitioner(BaseDatasetSplitter S)
S
- Dataset splitterprotected void checkModelCount(int n)
n
- Number of models requiredprotected void train_protected(Dataset TrainingData)
BaseModel
train_protected
in class BaseModel
TrainingData
- Training datapublic void run_protected(Dataset Data)
BaseModel
run_protected
in class BaseModel
Data
- Training datapublic java.lang.String printCommand(java.util.List<java.lang.String> Command) throws java.lang.Exception
Printable
printCommand
in interface Printable
printCommand
in class BaseModel
Command
- Command specifying what to printjava.lang.Exception
- If command not understoodprotected 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 BaseModel
Command
- Command as a list of objectsjava.lang.Exception
- If something goes wrongpublic java.util.List<org.apache.commons.lang3.tuple.Pair<java.lang.String,Citation>> getCitations()
Citable
getCitations
in interface Citable
getCitations
in class BaseModel