create.stratified.fold.df: DataFrame for stratified cross validation

View source: R/perf.meas.R

create.stratified.fold.dfR 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 (def. folds=5).

seed

initialization seed for the random generator to create folds (def. seed=23). If seed=NULL, the stratified folds are generated without seed initialization.

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 as pos or neg;

  • 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);

AnacletoLAB/HEMDAG documentation built on Oct. 14, 2022, 9:18 p.m.