# comp.metr: Compute metrics

### Description

A group of functions to plot precision-recall and ROC curves and to compute f-scores from the matrix returned by the evaluate function.

### Usage

 1 2 3 4 5  fscore(table, beta=1) auroc(table,k=-1) aupr(table,k=-1) pr.plot(table,device=-1,...) roc.plot(table,device=-1,...) 

### Arguments

 table This is the matrix returned by the evaluate function where columns contain the confusion matrix TP,FP,TN,FN values. - see evaluate. beta Numeric used as the weight of the recall in the f-score formula - see details. The default value of this argument is -1, meaning precision as important as recall. k Numeric used as the index to compute the area under the curve until that point- see details. The default value of this argument is -1, meaning that the whole area under the curve is computed device The device to be used. This parameter allows the user to plot precision-recall and receiver operating characteristic curves for various inference algorithms on the same plotting window - see examples. ... Arguments passed to plot.

### Details

A confusion matrix contains FP,TP,FN,FP values.

• "true positive rate" tpr = TP/(TN+TP)

• "false positive rate" fpr = FP/(FN+FP)

• "precision" p = TP/(FP+TP)

• "recall" r = TP/(TP+FN)

• "f-beta-score" F_β = (1+β) \frac{p r} {r + β p} Fbeta = (1+beta) * p*r/(r + beta*p)

### Value

The function roc.plot (pr.plot) plots the ROC-curve (PR-curve) and returns the device associated with the plotting window.

The function auroc (aupr) computes the area under the ROC-curve (PR-curve) using the trapezoidal approximation until point k.

The function fscore returns fscores according to the confusion matrices contained in the 'table' argument - see details.

evaluate, plot

### Examples

 1 2 3 4 5 6 7 8 9  # Inference Net <- cor(syntren300.data) # Validation tbl <- evaluate(Net,syntren300.net) # Plot PR-Curves max(fscore(tbl)) dev <- pr.plot(tbl, col="green", type="l") aupr(tbl) idx <- which.max(fscore(tbl)) 

Search within the netbenchmark package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.