Model {agghoo} | R Documentation |
R6 class representing a (generic) model.
Description
"Model" class, containing a (generic) learning function, which from data + target [+ params] returns a prediction function X –> y. Parameters for cross-validation are either provided or estimated. Model family can be chosen among "tree", "ppr" and "knn" for now.
Public fields
nmodels
Number of parameters (= number of [predictive] models)
Methods
Public methods
Method new()
Create a new generic model.
Usage
Model$new(data, target, task, gmodel = NULL, params = NULL)
Arguments
data
Matrix or data.frame
target
Vector of targets (generally numeric or factor)
task
"regression" or "classification"
gmodel
Generic model returning a predictive function; chosen automatically given data and target nature if not provided.
params
List of parameters for cross-validation (each defining a model)
Method get()
Returns the model at index "index", trained on dataHO/targetHO.
Usage
Model$get(dataHO, targetHO, index)
Arguments
dataHO
Matrix or data.frame
targetHO
Vector of targets (generally numeric or factor)
index
Index of the model in 1...nmodels
Method getParam()
Returns the parameter at index "index".
Usage
Model$getParam(index)
Arguments
index
Index of the model in 1...nmodels
Method clone()
The objects of this class are cloneable with this method.
Usage
Model$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.