The plot function creates a plot of performance evaluation metrics.
Usage
# S3 method for class 'sscurves'
plot(x, y = NULL, ...)
# S3 method for class 'mscurves'
plot(x, y = NULL, ...)
# S3 method for class 'smcurves'
plot(x, y = NULL, ...)
# S3 method for class 'mmcurves'
plot(x, y = NULL, ...)
# S3 method for class 'sspoints'
plot(x, y = NULL, ...)
# S3 method for class 'mspoints'
plot(x, y = NULL, ...)
# S3 method for class 'smpoints'
plot(x, y = NULL, ...)
# S3 method for class 'mmpoints'
plot(x, y = NULL, ...)
# S3 method for class 'ssxycurves'
plot(x, y = NULL, ...)
# S3 method for class 'msxycurves'
plot(x, y = NULL, ...)
# S3 method for class 'smxycurves'
plot(x, y = NULL, ...)
# S3 method for class 'mmxycurves'
plot(x, y = NULL, ...)Arguments
- x
An
S3object generated byevalmod(). Theplotfunction accepts the followingS3objects.ROC and Precision-Recall curves (mode = "rocprc")
S3object# of models # of test datasets sscurves single single mscurves multiple single smcurves single multiple mmcurves multiple multiple Basic evaluation metrics (mode = "basic")
S3object# of models # of test datasets sspoints single single mspoints multiple single smpoints single multiple mmpoints multiple multiple
See the Value section of
evalmod()for more details.- y
Equivalent with
curvetype.- ...
All the following arguments can be specified.
- curvetype
-
ROC and Precision-Recall curves (mode = "rocprc")
curvetype description ROC ROC curve PRC Precision-Recall curve Multiple
curvetypecan be combined, such asc("ROC", "PRC").Basic evaluation metrics (mode = "basic")
curvetype description error Normalized ranks vs. error rate accuracy Normalized ranks vs. accuracy specificity Normalized ranks vs. specificity sensitivity Normalized ranks vs. sensitivity precision Normalized ranks vs. precision mcc Normalized ranks vs. Matthews correlation coefficient fscore Normalized ranks vs. F-score balanced_accuracy Normalized ranks vs. balanced accuracy npv Normalized ranks vs. negative predictive value informedness Normalized ranks vs. informedness (Youden's J) markedness Normalized ranks vs. markedness kappa Normalized ranks vs. Cohen's kappa Multiple
curvetypecan be combined, such asc("precision", "sensitivity").
- type
A character to specify the line type as follows.
- "l"
lines
- "p"
points
- "b"
both lines and points
- show_cb
A Boolean value to specify whether point-wise confidence bounds are drawn. It is effective only when
calc_avgof theevalmod()function is set toTRUE.- raw_curves
A Boolean value to specify whether raw curves are shown instead of the average curve. It is effective only when
raw_curvesof theevalmod()function is set toTRUE.- show_legend
A Boolean value to specify whether the legend is shown.
See also
evalmod() for generating an S3 object.
autoplot() for plotting the equivalent curves
with ggplot2.
Examples
if (FALSE) { # \dontrun{
##################################################
### Single model & single test dataset
###
## Load a dataset with 10 positives and 10 negatives
data(P10N10)
## Generate an sscurve object that contains ROC and Precision-Recall curves
sscurves <- evalmod(scores = P10N10$scores, labels = P10N10$labels)
## Plot both ROC and Precision-Recall curves
plot(sscurves)
## Plot a ROC curve
plot(sscurves, curvetype = "ROC")
## Plot a Precision-Recall curve
plot(sscurves, curvetype = "PRC")
## Generate an sspoints object that contains basic evaluation metrics
sspoints <- evalmod(
mode = "basic", scores = P10N10$scores,
labels = P10N10$labels
)
## Plot normalized ranks vs. basic evaluation metrics
plot(sspoints)
## Plot normalized ranks vs. precision
plot(sspoints, curvetype = "precision")
##################################################
### Multiple models & single test dataset
###
## Create sample datasets with 100 positives and 100 negatives
samps <- create_sim_samples(1, 100, 100, "all")
mdat <- mmdata(samps[["scores"]], samps[["labels"]],
modnames = samps[["modnames"]]
)
## Generate an mscurve object that contains ROC and Precision-Recall curves
mscurves <- evalmod(mdat)
## Plot both ROC and Precision-Recall curves
plot(mscurves)
## Hide the legend
plot(mscurves, show_legend = FALSE)
## Generate an mspoints object that contains basic evaluation metrics
mspoints <- evalmod(mdat, mode = "basic")
## Plot normalized ranks vs. basic evaluation metrics
plot(mspoints)
## Hide the legend
plot(mspoints, show_legend = FALSE)
##################################################
### Single model & multiple test datasets
###
## Create sample datasets with 100 positives and 100 negatives
samps <- create_sim_samples(10, 100, 100, "good_er")
mdat <- mmdata(samps[["scores"]], samps[["labels"]],
modnames = samps[["modnames"]],
dsids = samps[["dsids"]]
)
## Generate an smcurve object that contains ROC and Precision-Recall curves
smcurves <- evalmod(mdat, raw_curves = TRUE)
## Plot average ROC and Precision-Recall curves
plot(smcurves, raw_curves = FALSE)
## Hide confidence bounds
plot(smcurves, raw_curves = FALSE, show_cb = FALSE)
## Plot raw ROC and Precision-Recall curves
plot(smcurves, raw_curves = TRUE, show_cb = FALSE)
## Generate an smpoints object that contains basic evaluation metrics
smpoints <- evalmod(mdat, mode = "basic")
## Plot normalized ranks vs. average basic evaluation metrics
plot(smpoints)
##################################################
### Multiple models & multiple test datasets
###
## Create sample datasets with 100 positives and 100 negatives
samps <- create_sim_samples(10, 100, 100, "all")
mdat <- mmdata(samps[["scores"]], samps[["labels"]],
modnames = samps[["modnames"]],
dsids = samps[["dsids"]]
)
## Generate an mscurve object that contains ROC and Precision-Recall curves
mmcurves <- evalmod(mdat, raw_curves = TRUE)
## Plot average ROC and Precision-Recall curves
plot(mmcurves, raw_curves = FALSE)
## Show confidence bounds
plot(mmcurves, raw_curves = FALSE, show_cb = TRUE)
## Plot raw ROC and Precision-Recall curves
plot(mmcurves, raw_curves = TRUE)
## Generate an mmpoints object that contains basic evaluation metrics
mmpoints <- evalmod(mdat, mode = "basic")
## Plot normalized ranks vs. average basic evaluation metrics
plot(mmpoints)
##################################################
### N-fold cross validation datasets
###
## Load test data
data(M2N50F5)
## Speficy nessesary columns to create mdat
cvdat <- mmdata(
nfold_df = M2N50F5, score_cols = c(1, 2),
lab_col = 3, fold_col = 4,
modnames = c("m1", "m2"), dsids = 1:5
)
## Generate an mmcurve object that contains ROC and Precision-Recall curves
cvcurves <- evalmod(cvdat)
## Average ROC and Precision-Recall curves
plot(cvcurves)
## Show confidence bounds
plot(cvcurves, show_cb = TRUE)
## Generate an mmpoints object that contains basic evaluation metrics
cvpoints <- evalmod(cvdat, mode = "basic")
## Normalized ranks vs. average basic evaluation metrics
plot(cvpoints)
} # }