| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/prediction.R |
| 3 |
\name{prediction} |
| 4 |
\alias{prediction} |
| 5 |
\title{Function to create prediction objects} |
| 6 |
\usage{ |
| 7 |
prediction(predictions, labels, label.ordering = NULL) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{predictions}{A vector, matrix, list, or data frame containing the |
| 11 |
predictions.} |
| 12 |
|
| 13 |
\item{labels}{A vector, matrix, list, or data frame containing the true class |
| 14 |
labels. Must have the same dimensions as \code{predictions}.} |
| 15 |
|
| 16 |
\item{label.ordering}{The default ordering (cf.details) of the classes can |
| 17 |
be changed by supplying a vector containing the negative and the positive |
| 18 |
class label.} |
| 19 |
} |
| 20 |
\value{ |
| 21 |
An S4 object of class \code{prediction}. |
| 22 |
} |
| 23 |
\description{ |
| 24 |
Every classifier evaluation using ROCR starts with creating a |
| 25 |
\code{prediction} object. This function is used to transform the input data |
| 26 |
(which can be in vector, matrix, data frame, or list form) into a |
| 27 |
standardized format. |
| 28 |
} |
| 29 |
\details{ |
| 30 |
\code{predictions} and \code{labels} can simply be vectors of the same |
| 31 |
length. However, in the case of cross-validation data, different |
| 32 |
cross-validation runs can be provided as the *columns* of a matrix or |
| 33 |
data frame, or as the entries of a list. In the case of a matrix or |
| 34 |
data frame, all cross-validation runs must have the same length, whereas |
| 35 |
in the case of a list, the lengths can vary across the cross-validation |
| 36 |
runs. Internally, as described in section 'Value', all of these input |
| 37 |
formats are converted to list representation. |
| 38 |
|
| 39 |
Since scoring classifiers give relative tendencies towards a negative |
| 40 |
(low scores) or positive (high scores) class, it has to be declared |
| 41 |
which class label denotes the negative, and which the positive class. |
| 42 |
Ideally, labels should be supplied as ordered factor(s), the lower |
| 43 |
level corresponding to the negative class, the upper level to the |
| 44 |
positive class. If the labels are factors (unordered), numeric, |
| 45 |
logical or characters, ordering of the labels is inferred from |
| 46 |
R's built-in \code{<} relation (e.g. 0 < 1, -1 < 1, 'a' < 'b', |
| 47 |
FALSE < TRUE). Use \code{label.ordering} to override this default |
| 48 |
ordering. Please note that the ordering can be locale-dependent |
| 49 |
e.g. for character labels '-1' and '1'. |
| 50 |
|
| 51 |
Currently, ROCR supports only binary classification (extensions toward |
| 52 |
multiclass classification are scheduled for the next release, |
| 53 |
however). If there are more than two distinct label symbols, execution |
| 54 |
stops with an error message. If all predictions use the same two |
| 55 |
symbols that are used for the labels, categorical predictions are |
| 56 |
assumed. If there are more than two predicted values, but all numeric, |
| 57 |
continuous predictions are assumed (i.e. a scoring |
| 58 |
classifier). Otherwise, if more than two symbols occur in the |
| 59 |
predictions, and not all of them are numeric, execution stops with an |
| 60 |
error message. |
| 61 |
} |
| 62 |
\examples{ |
| 63 |
# create a simple prediction object |
| 64 |
library(ROCR) |
| 65 |
data(ROCR.simple) |
| 66 |
pred <- prediction(ROCR.simple$predictions,ROCR.simple$labels) |
| 67 |
pred |
| 68 |
} |
| 69 |
\references{ |
| 70 |
A detailed list of references can be found on the ROCR homepage at |
| 71 |
\url{https://ipa-tys.github.io/ROCR/}. |
| 72 |
} |
| 73 |
\seealso{ |
| 74 |
\code{\link{prediction-class}}, |
| 75 |
\code{\link{performance}}, |
| 76 |
\code{\link{performance-class}}, |
| 77 |
\code{\link{plot.performance}} |
| 78 |
} |
| 79 |
\author{ |
| 80 |
Tobias Sing \email{[email protected]}, Oliver Sander |
| 81 |
\email{[email protected]} |
| 82 |
} |