| 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
nmodelsNumber 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
dataMatrix or data.frame
targetVector of targets (generally numeric or factor)
task"regression" or "classification"
gmodelGeneric model returning a predictive function; chosen automatically given data and target nature if not provided.
paramsList 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
dataHOMatrix or data.frame
targetHOVector of targets (generally numeric or factor)
indexIndex of the model in 1...nmodels
Method getParam()
Returns the parameter at index "index".
Usage
Model$getParam(index)
Arguments
indexIndex of the model in 1...nmodels
Method clone()
The objects of this class are cloneable with this method.
Usage
Model$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.