Learn R Programming

RANKS (version 1.1)

multiple.ker.score.cv: RANKS multiple cross-validation for a single class

Description

Function to execute multiple cross-validation with RANKS for a single class.

Usage

multiple.ker.score.cv(RW, ind.pos, m = 5, p = 100, stratified=TRUE, 
                      init.seed = 0, fun = KNN.score, ...)

Value

A list with two components:

av.scores

a vector with the average scores across multiple cross-validations. Elements of the vector av.scores correspond to the rows of RW

pos.scores

a vector with the scores of positive elements collected at each iteration

Arguments

RW

matrix. Kernel matrix or any valid symmetric matrix

ind.pos

indices of the positive examples. They are the row indices of RW corresponding to positive examples.

m

number of folds for each cross-validation

p

number of repeated cross-validations

stratified

boolean. If TRUE (def.) stratified CV is performed otherwise vanilla CV is done

init.seed

initial seed for the random generator (def: 0)

fun

function. It must be a kernel-based score method (default KNN.score)

...

optional arguments for the function fun

Details

It performs multiple cross-validation using RANKS to predict the cross-validated scores. The cross-validation is stratified: the folds are constructed separately for each class, to maintain an equal ratio between classes among folds. It computes the scores by averaging across multiple cross validations.

See Also

ker.score.cv, multiple.ker.score.thresh.cv, rw.kernel-methods, Kernel functions.

Examples

Run this code
# Nodel label ranking for the DrugBank category Penicillins
# on the Tanimoto chemical structure similarity network (1253 drugs)
# using 5 fold cross-validation repeated 10 times
# and eav-score with 1-step random walk kernel
library(bionetdata);
data(DD.chem.data);
data(DrugBank.Cat);
labels <- DrugBank.Cat[,"Penicillins"];
ind.pos <- which(labels==1);
K <- rw.kernel(DD.chem.data);
res <- multiple.ker.score.cv(K, ind.pos, m = 5, p = 10, init.seed = 0, fun = eav.score);
# the same but using the NN-score
res <- multiple.ker.score.cv(K, ind.pos, m = 5, p = 10, init.seed = 0, fun = NN.score);

Run the code above in your browser using DataLab