stratified.cross.validation: Stratified Cross Validation

Description Usage Arguments Details Value Examples

Description

Generate data for the stratified cross-validation.

Usage

1
2
3
4
5
do.stratified.cv.data.single.class(examples, positives, kk = 5,
  seed = NULL)

do.stratified.cv.data.over.classes(labels, examples, kk = 5,
  seed = NULL)

Arguments

examples

indices or names of the examples. Can be either a vector of integers or a vector of names.

positives

vector of integers or vector of names. The indices (or names) refer to the indices (or names) of 'positive' examples.

kk

number of folds (def. kk=5).

seed

seed of the random generator (def. seed=NULL). If is set to NULL no initialization is performed.

labels

labels matrix. Rows are genes and columns are classes. Let's denote M the labels matrix. If M[i,j]=1, means that the gene i is annotated with the class j, otherwise M[i,j]=0.

Details

the folds are stratified, i.e. contain the same amount of positive and negative examples.

Value

do.stratified.cv.data.single.class returns a list with 2 two component:

do.stratified.cv.data.over.classes returns a list with n components, where n is the number of classes of the labels matrix. Each component n is in turn a list with k elements, where k is the number of folds. Each fold contains an equal amount of positives and negatives examples.

Examples

1
2
3
4
5
6
7
8
data(labels);
examples.index <- 1:nrow(L);
examples.name <- rownames(L);
positives <- which(L[,3]==1);
x <- do.stratified.cv.data.single.class(examples.index, positives, kk=5, seed=23);
y <- do.stratified.cv.data.single.class(examples.name, positives, kk=5, seed=23);
z <- do.stratified.cv.data.over.classes(L, examples.index, kk=5, seed=23);
k <- do.stratified.cv.data.over.classes(L, examples.name, kk=5, seed=23);

gecko515/HEMDAG documentation built on Oct. 18, 2019, 6:34 a.m.