getMetrics {BioMM} | R Documentation |
Compute the evaluation metrics in the classification setting: P value based on chi-square test (pv), pearson correlation coefficient (cor), area under curve (AUC), classification accuracy (ACC) and the pseudo R square (R2).
getMetrics(dataY, predY)
dataY |
The observed outcome. |
predY |
The predicted outcome. |
If all samples are predicted into one class, then we assign R2=0, cor=0, and AUC=0.5.
A set of metrics for model evaluation: pv, cor, AUC, ACC and R2.
Junfang Chen
## Load data methylfile <- system.file('extdata', 'methylData.rds', package='BioMM') methylData <- readRDS(methylfile) dataY <- methylData[,1] methylSub <- data.frame(label=dataY, methylData[,c(2:1001)]) library(ranger) library(rms) library(BiocParallel) param1 <- MulticoreParam(workers = 1) param2 <- MulticoreParam(workers = 10) predY <- predByCV(methylSub, repeats=1, nfolds=10, FSmethod=NULL, cutP=0.1, fdr=NULL, FScore=param1, classifier='randForest', predMode='classification', paramlist=list(ntree=300, nthreads=20), innerCore=param2) accuracy <- getMetrics(dataY=dataY, predY=predY) print(accuracy)