ker.score.classifier.cv {RANKS} | R Documentation |
Multiple cross-validation with RANKS for classification
Description
Function to classify labels according to an external cross-validation procedure with a kernel-based score method.
Usage
ker.score.classifier.cv(K, ind.pos, m = 5, p = 100,
alpha = seq(from = 0.05, to = 0.6, by = 0.05), init.seed = 0,
opt.fun = compute.F, fun = KNN.score, ...)
Arguments
K |
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 |
alpha |
vector of the quantiles to be tested |
init.seed |
initial seed for the random generator (def: 0) |
opt.fun |
: function. Function implementing the metric to choice the optimal threshold. The F-score (compute.F) is the default. Available functions: - compute.F: F-score (default) - compute.acc: accuracy. Any function having two arguments representing the vector of predicted and true labels can be in principle used. |
fun |
function. It must be a kernel-based score method (default KNN.score) |
... |
optional arguments for the function fun |
Details
Function to classify labels according to an external cross-validation procedure with a kernel-based score method. The optimal threshold for a given class id found by internal cross-validation. Scores are computed by averaging across (possibly) multiple external cross-validations. The optimal quantile and corresponding threshold are selected by internal cross-validation using the F-score (default) or the accuracy as metric.
Value
A list with 4 components:
labels |
vector of the predicted labels (1 represents positive, 0 negative) |
av.scores |
a vector with the average scores across multiple cross-validations. Elements of the vector av.scores correspond to the rows of RW |
opt.alpha |
the optimal quantile alpha |
opt.thresh |
the optimal threshold |
a vector of the predicted scores for the test set
See Also
rw.kernel-methods
, Kernel functions
, ker.score.classifier.holdout
Examples
# Nodel label classification of the DrugBank category Penicillins
# on the Tanimoto chemical structure similarity network (1253 drugs)
# using 5 fold cross-validation repeated 3 times
# and NN-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.classifier.cv(K, ind.pos, m = 5, p = 3, fun = NN.score);