create.stratified.fold.df {HEMDAG} | R Documentation |
DataFrame for stratified cross validation
Description
Create a data frame for stratified cross-validation.
Usage
create.stratified.fold.df(labels, scores, folds = 5, seed = 23)
Arguments
labels |
vector of the true labels (0 negative, 1 positive). |
scores |
a numeric vector of the values of the predicted labels. |
folds |
number of folds of the cross validation ( |
seed |
initialization seed for the random generator to create folds ( |
Details
Folds are stratified, i.e. contain the same amount of positive and negative examples.
Value
A data frame with three columns:
-
scores
: contains the predicted scores; -
labels
: contains the labels aspos
orneg
; -
folds
: contains the index of the fold in which the example falls. The index can range from 1 to the number of folds.
Examples
data(labels);
data(scores);
df <- create.stratified.fold.df(L[,3], S[,3], folds=5, seed=23);
[Package HEMDAG version 2.7.4 Index]