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

View source: R/RANKS.1.1.R

ker.score.cvR Documentation

RANKS cross-validation for a single class

Description

Function to perform cross-validation for a single class with a kernel-based score method

Usage

ker.score.cv(RW, ind.pos, m = 5, init.seed = NULL, fun = KNN.score, ...)

Arguments

RW

matrix. It can be a kernel matrix or the adjacency matrix of a graph

ind.pos

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

m

number of folds (def: 5)

init.seed

initial seed for the random generator to generate folds. If NULL (default) no initialization is performed

fun

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

...

optional arguments for the function fun

Details

It performs a 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.

Value

a numeric vector with the scores computed for each example

See Also

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

Examples

# Nodel label ranking of the DrugBank category Penicillins
# on the Tanimoto chemical structure similarity network (1253 drugs)
# using 5 fold cross-validation
# 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 <- ker.score.cv(K, ind.pos, m = 5, init.seed = NULL, fun = eav.score);

RANKS documentation built on Sept. 21, 2022, 9:06 a.m.