getMetrics {BioMM} | R Documentation

## Compute the machine learning evaluation metrics

### Description

Compute the evaluation metrics in the classification setting: area under curve (AUC), the area under the Precision-Recall curve, classification accuracy (ACC) and the pseudo R square (R2).

### Usage

    getMetrics(dataY, predY)

### Arguments

`dataY` | The observed outcome.
`predY` | The predicted outcome.

### Details

If all samples are predicted into one class, then R2 is 0.

### Value

A set of metrics for model evaluation: AUC, AUCPR, ACC and R2.

### Author(s)

Junfang Chen

### Examples

    ## 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(precrec)
    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)
    metrics <- getMetrics(dataY=dataY, predY=predY)
    print(metrics)

[Package BioMM version 1.10.0 Index]