Function to assess the prediction performance via Precision-Recall (PR) analysis

Description

xPredictPR is supposed to assess the prediction performance via Precision-Recall (PR) analysis. It requires two inputS: 1) Glod Standard Positive (GSP) containing targets; 2) prediction containing predicted targets and predictive scores.

Usage

1
2
xPredictPR(GSP, prediction, num.threshold = 100, bin = c("quantile",
"uniform"), recall.prediction = FALSE, plot = FALSE, verbose = TRUE)

Arguments

GSP

a vector containing Glod Standard Positive (GSP)

prediction

a data frame containing predictions along with predictive scores. It has two columns: 1st column for target, 2nd column for predictive scores (the higher the better)

num.threshold

an integer to specify how many PR points (as a function of the score threshold) will be calculated

bin

how to bin the scores. It can be "uniform" for binning scores with equal interval (ie with uniform distribution), and 'quantile' for binning scores with eual frequency (ie with equal number)

recall.prediction

logical to indicate whether the calculation of recall is based on preditable GSP. By default, it sets to FALSE

plot

logical to indicate whether to return an object of class "ggplot" for plotting PR curve. By default, it sets to FALSE. If TRUE, it will return a ggplot object after being appended with 'PR'

verbose

logical to indicate whether the messages will be displayed in the screen. By default, it sets to TRUE for display

Value

If plot is FALSE (by default), a data frame containing two columns: 1st column 'Precision' for precision, 2nd 'Recall' for recall. The row has the names corresponding to the score threshold. If plot is TRUE, it will return a ggplot object after being appended with 'PR' (a data frame containing two columns: 1st column 'Precision' for precision, 2nd 'Recall' for recall. The row has the names corresponding to the score threshold).

Note

F-measure: the maximum of a harmonic mean between precision and recall along PR curve

Examples

1
2
3
4
## Not run: 
PR <- xPredictPR(GSP, prediction)

## End(Not run)