AgghooCV {agghoo} | R Documentation |
R6 class with agghoo functions fit() and predict().
Description
Class encapsulating the methods to run to obtain the best predictor from the list of models (see 'Model' class).
Methods
Public methods
Method new()
Create a new AgghooCV object.
Usage
AgghooCV$new(data, target, task, gmodel, loss)
Arguments
data
Matrix or data.frame
target
Vector of targets (generally numeric or factor)
task
"regression" or "classification". Default: classification if target not numeric.
gmodel
Generic model returning a predictive function Default: tree if mixed data, knn/ppr otherwise.
loss
Function assessing the error of a prediction Default: error rate or mean(abs(error)).
Method fit()
Fit an agghoo model.
Usage
AgghooCV$fit(CV = NULL)
Arguments
CV
List describing cross-validation to run. Slots:
- type: 'vfold' or 'MC' for Monte-Carlo (default: MC)
- V: number of runs (default: 10)
- test_size: percentage of data in the test dataset, for MC (irrelevant for V-fold). Default: 0.2.
- shuffle: wether or not to shuffle data before V-fold. Irrelevant for Monte-Carlo; default: TRUE
Default (if NULL): type="MC", V=10, test_size=0.2
Method predict()
Predict an agghoo model (after calling fit())
Usage
AgghooCV$predict(X)
Arguments
X
Matrix or data.frame to predict
Method getParams()
Return the list of V best parameters (after calling fit())
Usage
AgghooCV$getParams()
Method clone()
The objects of this class are cloneable with this method.
Usage
AgghooCV$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.