File: prediction.Rd

package info (click to toggle)
r-cran-rocr 1.0-11-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 676 kB
  • sloc: sh: 13; makefile: 2
file content (82 lines) | stat: -rw-r--r-- 3,373 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/prediction.R
\name{prediction}
\alias{prediction}
\title{Function to create prediction objects}
\usage{
prediction(predictions, labels, label.ordering = NULL)
}
\arguments{
\item{predictions}{A vector, matrix, list, or data frame containing the
predictions.}

\item{labels}{A vector, matrix, list, or data frame containing the true class
labels. Must have the same dimensions as \code{predictions}.}

\item{label.ordering}{The default ordering (cf.details)  of the classes can
be changed by supplying a vector containing the negative and the positive
class label.}
}
\value{
An S4 object of class \code{prediction}.
}
\description{
Every classifier evaluation using ROCR starts with creating a
\code{prediction} object. This function is used to transform the input data
(which can be in vector, matrix, data frame, or list form) into a
standardized format.
}
\details{
\code{predictions} and \code{labels} can simply be vectors of the same
length. However, in the case of cross-validation data, different
cross-validation runs can be provided as the *columns* of a matrix or
data frame, or as the entries of a list. In the case of a matrix or
data frame, all cross-validation runs must have the same length, whereas
in the case of a list, the lengths can vary across the cross-validation
runs. Internally, as described in section 'Value', all of these input
formats are converted to list representation.

Since scoring classifiers give relative tendencies towards a negative
(low scores) or positive (high scores) class, it has to be declared
which class label denotes the negative, and which the positive class.
Ideally, labels should be supplied as ordered factor(s), the lower
level corresponding to the negative class, the upper level to the
positive class. If the labels are factors (unordered), numeric,
logical or characters, ordering of the labels is inferred from
R's built-in \code{<} relation (e.g. 0 < 1, -1 < 1, 'a' < 'b',
FALSE < TRUE). Use \code{label.ordering} to override this default
ordering. Please note that the ordering can be locale-dependent
e.g. for character labels '-1' and '1'.

Currently, ROCR supports only binary classification (extensions toward
multiclass classification are scheduled for the next release,
however). If there are more than two distinct label symbols, execution
stops with an error message. If all predictions use the same two
symbols that are used for the labels, categorical predictions are
assumed. If there are more than two predicted values, but all numeric,
continuous predictions are assumed (i.e. a scoring
classifier). Otherwise, if more than two symbols occur in the
predictions, and not all of them are numeric, execution stops with an
error message.
}
\examples{
# create a simple prediction object
library(ROCR)
data(ROCR.simple)
pred <- prediction(ROCR.simple$predictions,ROCR.simple$labels)
pred
}
\references{
A detailed list of references can be found on the ROCR homepage at
\url{http://rocr.bioinf.mpi-sb.mpg.de}.
}
\seealso{
\code{\link{prediction-class}},
\code{\link{performance}},
\code{\link{performance-class}},
\code{\link{plot.performance}}
}
\author{
Tobias Sing \email{tobias.sing@gmail.com}, Oliver Sander
\email{osander@gmail.com}
}