Perform the cross validation procedure for multi-label learning.
cv(mdata, method, ..., cv.folds = 10, cv.sampling = c("random", "iterative",
"stratified"), cv.results = FALSE, cv.measures = "all",
cv.cores = getOption("utiml.cores", 1), cv.seed = getOption("utiml.seed",
NA))
A mldr dataset.
The multi-label classification method. It also accepts the name of the method as a string.
Additional parameters required by the method.
Number of folds. (Default: 10)
The method to split the data. The default methods are:
Split randomly the folds.
Split the folds considering the labels proportions individually. Some specific label can not occurs in all folds.
Split the folds considering the labelset proportions.
(Default: "random")
Logical value indicating if the folds results should be reported (Default: FALSE).
The measures names to be computed. Call
multilabel_measures()
to see the expected measures. You can also
use "bipartition"
, "ranking"
, "label-based"
,
"example-based"
, "macro-based"
, "micro-based"
and
"label-problem"
to include a set of measures. (Default: "all").
The number of cores to parallelize the cross validation procedure.
(Default: options("utiml.cores", 1)
)
An optional integer used to set the seed. (Default:
options("utiml.seed", NA)
)
If cv.results is FALSE return a vector with the expected multi-label measures, otherwise, a list contained the multi-label and label measures for each fold.
Other evaluation: multilabel_confusion_matrix
,
multilabel_evaluate
,
multilabel_measures
# NOT RUN {
#Run 10 folds for BR method
res1 <- cv(toyml, br, base.algorithm="RANDOM", cv.folds=10)
#Run 3 folds for RAkEL method and get the fold results
res2 <- cv(mdata=toyml, method="rakel", base.algorithm="RANDOM", k=2, m=10,
cv.folds=3, cv.results=TRUE)
# }
Run the code above in your browser using DataLab