| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/zzz.R |
| 3 |
\name{plot-methods} |
| 4 |
\alias{plot-methods} |
| 5 |
\alias{plot,performance,missing-method} |
| 6 |
\alias{plot.performance} |
| 7 |
\title{Plot method for performance objects} |
| 8 |
\usage{ |
| 9 |
\S4method{plot}{performance,missing}( |
| 10 |
x, |
| 11 |
y, |
| 12 |
..., |
| 13 |
avg = "none", |
| 14 |
spread.estimate = "none", |
| 15 |
spread.scale = 1, |
| 16 |
show.spread.at = c(), |
| 17 |
colorize = FALSE, |
| 18 |
colorize.palette = rev(rainbow(256, start = 0, end = 4/6)), |
| 19 |
colorkey = colorize, |
| 20 |
colorkey.relwidth = 0.25, |
| 21 |
colorkey.pos = "right", |
| 22 |
print.cutoffs.at = c(), |
| 23 |
cutoff.label.function = function(x) { |
| 24 |
round(x, 2) |
| 25 |
}, |
| 26 |
downsampling = 0, |
| 27 |
add = FALSE |
| 28 |
) |
| 29 |
|
| 30 |
\method{plot}{performance}(...) |
| 31 |
} |
| 32 |
\arguments{ |
| 33 |
\item{x}{an object of class \code{performance}} |
| 34 |
|
| 35 |
\item{y}{not used} |
| 36 |
|
| 37 |
\item{...}{Optional graphical parameters to adjust different components of |
| 38 |
the performance plot. Parameters are directed to their target component by |
| 39 |
prefixing them with the name of the component (\code{component.parameter}, |
| 40 |
e.g. \code{text.cex}). The following components are available: |
| 41 |
\code{xaxis}, \code{yaxis}, \code{coloraxis}, \code{box} (around the |
| 42 |
plotting region), \code{points}, \code{text}, \code{plotCI} (error bars), |
| 43 |
\code{boxplot}. The names of these components are influenced by the R |
| 44 |
functions that are used to create them. Thus, \code{par(component)} can be |
| 45 |
used to see which parameters are available for a given component (with the |
| 46 |
expection of the three axes; use \code{par(axis)} here). To adjust the |
| 47 |
canvas or the performance curve(s), the standard \code{plot} parameters can |
| 48 |
be used without any prefix.} |
| 49 |
|
| 50 |
\item{avg}{If the performance object describes several curves (from |
| 51 |
cross-validation runs or bootstrap evaluations of one particular method), |
| 52 |
the curves from each of the runs can be averaged. Allowed values are |
| 53 |
\code{none} (plot all curves separately), \code{horizontal} (horizontal |
| 54 |
averaging), \code{vertical} (vertical averaging), and \code{threshold} |
| 55 |
(threshold (=cutoff) averaging). Note that while threshold averaging is |
| 56 |
always feasible, vertical and horizontal averaging are not well-defined if |
| 57 |
the graph cannot be represented as a function x->y and y->x, respectively.} |
| 58 |
|
| 59 |
\item{spread.estimate}{When curve averaging is enabled, the variation around |
| 60 |
the average curve can be visualized as standard error bars |
| 61 |
(\code{stderror}), standard deviation bars (\code{stddev}), or by using box |
| 62 |
plots (\code{boxplot}). Note that the function \code{plotCI}, which is used |
| 63 |
internally by ROCR to draw error bars, might raise a warning if the spread |
| 64 |
of the curves at certain positions is 0.} |
| 65 |
|
| 66 |
\item{spread.scale}{For \code{stderror} or \code{stddev}, this is a scalar |
| 67 |
factor to be multiplied with the length of the standard error/deviation |
| 68 |
bar. For example, under normal assumptions, \code{spread.scale=2} can be |
| 69 |
used to get approximate 95\% confidence intervals.} |
| 70 |
|
| 71 |
\item{show.spread.at}{For vertical averaging, this vector determines the x |
| 72 |
positions for which the spread estimates should be visualized. In contrast, |
| 73 |
for horizontal and threshold averaging, the y positions and cutoffs are |
| 74 |
determined, respectively. By default, spread estimates are shown at 11 |
| 75 |
equally spaced positions.} |
| 76 |
|
| 77 |
\item{colorize}{This logical determines whether the curve(s) should be |
| 78 |
colorized according to cutoff.} |
| 79 |
|
| 80 |
\item{colorize.palette}{If curve colorizing is enabled, this determines the |
| 81 |
color palette onto which the cutoff range is mapped.} |
| 82 |
|
| 83 |
\item{colorkey}{If true, a color key is drawn into the 4\% border |
| 84 |
region (default of \code{par(xaxs)} and \code{par(yaxs)}) of the |
| 85 |
plot. The color key visualizes the mapping from cutoffs to colors.} |
| 86 |
|
| 87 |
\item{colorkey.relwidth}{Scalar between 0 and 1 that determines the |
| 88 |
fraction of the 4\% border region that is occupied by the colorkey.} |
| 89 |
|
| 90 |
\item{colorkey.pos}{Determines if the colorkey is drawn vertically at |
| 91 |
the \code{right} side, or horizontally at the \code{top} of the |
| 92 |
plot.} |
| 93 |
|
| 94 |
\item{print.cutoffs.at}{This vector specifies the cutoffs which should |
| 95 |
be printed as text along the curve at the corresponding curve positions.} |
| 96 |
|
| 97 |
\item{cutoff.label.function}{By default, cutoff annotations along the curve |
| 98 |
or at the color key are rounded to two decimal places before printing. |
| 99 |
Using a custom \code{cutoff.label.function}, any other transformation can |
| 100 |
be performed on the cutoffs instead (e.g. rounding with different precision |
| 101 |
or taking the logarithm).} |
| 102 |
|
| 103 |
\item{downsampling}{ROCR can efficiently compute most performance measures |
| 104 |
even for data sets with millions of elements. However, plotting of large |
| 105 |
data sets can be slow and lead to PS/PDF documents of considerable size. In |
| 106 |
that case, performance curves that are indistinguishable from the original |
| 107 |
can be obtained by using only a fraction of the computed performance |
| 108 |
values. Values for downsampling between 0 and 1 indicate the fraction of |
| 109 |
the original data set size to which the performance object should be |
| 110 |
downsampled, integers above 1 are interpreted as the actual number of |
| 111 |
performance values to which the curve(s) should be downsampled.} |
| 112 |
|
| 113 |
\item{add}{If \code{TRUE}, the curve(s) is/are added to an already existing |
| 114 |
plot; otherwise a new plot is drawn.} |
| 115 |
} |
| 116 |
\description{ |
| 117 |
This is the method to plot all objects of class performance. |
| 118 |
} |
| 119 |
\examples{ |
| 120 |
# plotting a ROC curve: |
| 121 |
library(ROCR) |
| 122 |
data(ROCR.simple) |
| 123 |
pred <- prediction( ROCR.simple$predictions, ROCR.simple$labels ) |
| 124 |
pred |
| 125 |
perf <- performance( pred, "tpr", "fpr" ) |
| 126 |
perf |
| 127 |
plot( perf ) |
| 128 |
|
| 129 |
# To entertain your children, make your plots nicer |
| 130 |
# using ROCR's flexible parameter passing mechanisms |
| 131 |
# (much cheaper than a finger painting set) |
| 132 |
par(bg="lightblue", mai=c(1.2,1.5,1,1)) |
| 133 |
plot(perf, main="ROCR fingerpainting toolkit", colorize=TRUE, |
| 134 |
xlab="Mary's axis", ylab="", box.lty=7, box.lwd=5, |
| 135 |
box.col="gold", lwd=17, colorkey.relwidth=0.5, xaxis.cex.axis=2, |
| 136 |
xaxis.col='blue', xaxis.col.axis="blue", yaxis.col='green', yaxis.cex.axis=2, |
| 137 |
yaxis.at=c(0,0.5,0.8,0.85,0.9,1), yaxis.las=1, xaxis.lwd=2, yaxis.lwd=3, |
| 138 |
yaxis.col.axis="orange", cex.lab=2, cex.main=2) |
| 139 |
} |
| 140 |
\references{ |
| 141 |
A detailed list of references can be found on the ROCR homepage at |
| 142 |
\url{https://ipa-tys.github.io/ROCR/}. |
| 143 |
} |
| 144 |
\seealso{ |
| 145 |
\code{\link{prediction}}, |
| 146 |
\code{\link{performance}}, |
| 147 |
\code{\link{prediction-class}}, |
| 148 |
\code{\link{performance-class}} |
| 149 |
} |
| 150 |
\author{ |
| 151 |
Tobias Sing \email{[email protected]}, Oliver Sander |
| 152 |
\email{[email protected]} |
| 153 |
} |