Description Usage Arguments Details Value Author(s) References See Also Examples
Every classifier evaluation using ROCR starts with creating a
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.
1 | prediction(predictions, labels, label.ordering = NULL)
|
predictions |
A vector, matrix, list, or data frame containing the predictions. |
labels |
A vector, matrix, list, or data frame containing the true class
labels. Must have the same dimensions as |
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. |
predictions
and 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 <
relation (e.g. 0 < 1, -1 < 1, 'a' < 'b',
FALSE < TRUE). Use 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.
An S4 object of class prediction
.
Tobias Sing tobias.sing@gmail.com, Oliver Sander osander@gmail.com
A detailed list of references can be found on the ROCR homepage at http://rocr.bioinf.mpi-sb.mpg.de.
prediction-class
,
performance
,
performance-class
,
plot.performance
1 2 3 4 5 | # create a simple prediction object
library(ROCR)
data(ROCR.simple)
pred <- prediction(ROCR.simple$predictions,ROCR.simple$labels)
pred
|
Loading required package: gplots
Attaching package: 'gplots'
The following object is masked from 'package:stats':
lowess
An object of class "prediction"
Slot "predictions":
[[1]]
[1] 0.612547843 0.364270971 0.432136142 0.140291078 0.384895941 0.244415489
[7] 0.970641299 0.890172812 0.781781371 0.868751832 0.716680598 0.360168796
[13] 0.547983407 0.385240464 0.423739359 0.101699993 0.628095575 0.744769966
[19] 0.657732644 0.490119891 0.072369921 0.172741714 0.105722115 0.890078186
[25] 0.945548941 0.984667270 0.360180429 0.448687336 0.014823599 0.543533783
[31] 0.292368449 0.701561487 0.715459280 0.714985914 0.120604738 0.319672178
[37] 0.911723615 0.757325590 0.090988280 0.529402244 0.257402979 0.589909284
[43] 0.708412104 0.326672910 0.086546283 0.879459891 0.362693564 0.230157183
[49] 0.779771989 0.876086217 0.353281048 0.212014560 0.703293499 0.689075677
[55] 0.627012496 0.240911145 0.402801992 0.134794140 0.120473353 0.665444679
[61] 0.536339509 0.623494622 0.885179651 0.353777439 0.408939895 0.265686095
[67] 0.932159806 0.248500489 0.858876675 0.491735594 0.151350957 0.694457482
[73] 0.496513160 0.123504905 0.499788081 0.310718619 0.907651100 0.340078180
[79] 0.195097957 0.371936985 0.517308606 0.419560072 0.865639036 0.018527600
[85] 0.539086009 0.005422562 0.772728821 0.703885141 0.348213542 0.277656869
[91] 0.458674210 0.059045866 0.133257805 0.083685883 0.531958184 0.429650397
[97] 0.717845453 0.537091350 0.212404891 0.930846938 0.083048377 0.468610247
[103] 0.393378108 0.663367560 0.349540913 0.194398425 0.844415442 0.959417835
[109] 0.211378771 0.943432189 0.598162949 0.834803976 0.576836208 0.380396459
[115] 0.161874325 0.912325837 0.642933593 0.392173971 0.122284044 0.586857799
[121] 0.180631658 0.085993218 0.700501359 0.060413627 0.531464015 0.084254795
[127] 0.448484671 0.938583020 0.531006532 0.785213140 0.905121019 0.748438143
[133] 0.605235403 0.842974300 0.835981859 0.364288579 0.492596896 0.488179708
[139] 0.259278968 0.991096434 0.757364019 0.288258273 0.773336236 0.040906997
[145] 0.110241034 0.760726142 0.984599159 0.253271061 0.697235328 0.620501132
[151] 0.814586047 0.300973098 0.378092079 0.016694412 0.698826511 0.658692553
[157] 0.470206008 0.501489336 0.239143340 0.050999138 0.088450984 0.107031842
[163] 0.746588080 0.480100183 0.336592126 0.579511087 0.118555284 0.233160827
[169] 0.461150807 0.370549294 0.770178504 0.537336015 0.463227453 0.790240205
[175] 0.883431431 0.745110673 0.007746305 0.012653524 0.868331219 0.439399995
[181] 0.540221346 0.567043171 0.035815400 0.806543942 0.248707470 0.696702150
[187] 0.081439129 0.336315317 0.126480399 0.636728451 0.030235062 0.268138293
[193] 0.983494405 0.728536415 0.739554341 0.522384507 0.858970526 0.383807972
[199] 0.606960209 0.138387070
Slot "labels":
[[1]]
[1] 1 1 0 0 0 1 1 1 1 0 1 0 1 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 1 1 0 1 1 1 0 0 1
[38] 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 1 1 1 1 0 0 0 1 0 1 0 0 1 0 0
[75] 0 0 0 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0 1 0 0 1 0 0 1 1
[112] 1 0 0 0 1 1 0 0 1 0 0 1 0 1 0 0 1 1 1 1 1 0 1 1 0 0 0 0 1 1 0 1 0 1 0 1 1
[149] 1 1 1 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0
[186] 0 0 1 0 0 0 1 0 1 1 0 1 0 1 0
Levels: 0 < 1
Slot "cutoffs":
[[1]]
[1] Inf 0.991096434 0.984667270 0.984599159 0.983494405 0.970641299
[7] 0.959417835 0.945548941 0.943432189 0.938583020 0.932159806 0.930846938
[13] 0.912325837 0.911723615 0.907651100 0.905121019 0.890172812 0.890078186
[19] 0.885179651 0.883431431 0.879459891 0.876086217 0.868751832 0.868331219
[25] 0.865639036 0.858970526 0.858876675 0.844415442 0.842974300 0.835981859
[31] 0.834803976 0.814586047 0.806543942 0.790240205 0.785213140 0.781781371
[37] 0.779771989 0.773336236 0.772728821 0.770178504 0.760726142 0.757364019
[43] 0.757325590 0.748438143 0.746588080 0.745110673 0.744769966 0.739554341
[49] 0.728536415 0.717845453 0.716680598 0.715459280 0.714985914 0.708412104
[55] 0.703885141 0.703293499 0.701561487 0.700501359 0.698826511 0.697235328
[61] 0.696702150 0.694457482 0.689075677 0.665444679 0.663367560 0.658692553
[67] 0.657732644 0.642933593 0.636728451 0.628095575 0.627012496 0.623494622
[73] 0.620501132 0.612547843 0.606960209 0.605235403 0.598162949 0.589909284
[79] 0.586857799 0.579511087 0.576836208 0.567043171 0.547983407 0.543533783
[85] 0.540221346 0.539086009 0.537336015 0.537091350 0.536339509 0.531958184
[91] 0.531464015 0.531006532 0.529402244 0.522384507 0.517308606 0.501489336
[97] 0.499788081 0.496513160 0.492596896 0.491735594 0.490119891 0.488179708
[103] 0.480100183 0.470206008 0.468610247 0.463227453 0.461150807 0.458674210
[109] 0.448687336 0.448484671 0.439399995 0.432136142 0.429650397 0.423739359
[115] 0.419560072 0.408939895 0.402801992 0.393378108 0.392173971 0.385240464
[121] 0.384895941 0.383807972 0.380396459 0.378092079 0.371936985 0.370549294
[127] 0.364288579 0.364270971 0.362693564 0.360180429 0.360168796 0.353777439
[133] 0.353281048 0.349540913 0.348213542 0.340078180 0.336592126 0.336315317
[139] 0.326672910 0.319672178 0.310718619 0.300973098 0.292368449 0.288258273
[145] 0.277656869 0.268138293 0.265686095 0.259278968 0.257402979 0.253271061
[151] 0.248707470 0.248500489 0.244415489 0.240911145 0.239143340 0.233160827
[157] 0.230157183 0.212404891 0.212014560 0.211378771 0.195097957 0.194398425
[163] 0.180631658 0.172741714 0.161874325 0.151350957 0.140291078 0.138387070
[169] 0.134794140 0.133257805 0.126480399 0.123504905 0.122284044 0.120604738
[175] 0.120473353 0.118555284 0.110241034 0.107031842 0.105722115 0.101699993
[181] 0.090988280 0.088450984 0.086546283 0.085993218 0.084254795 0.083685883
[187] 0.083048377 0.081439129 0.072369921 0.060413627 0.059045866 0.050999138
[193] 0.040906997 0.035815400 0.030235062 0.018527600 0.016694412 0.014823599
[199] 0.012653524 0.007746305 0.005422562
Slot "fp":
[[1]]
[1] 0 0 0 0 1 1 2 3 3 3 3 3 3 3 4 4 4 4
[19] 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5
[37] 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 8
[55] 9 9 9 9 9 9 10 10 11 11 11 11 11 11 12 12 12 12
[73] 12 12 12 13 13 13 13 13 14 14 14 14 14 15 15 15 15 15
[91] 15 15 15 16 16 16 17 18 19 20 21 22 23 24 25 26 27 28
[109] 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
[127] 47 47 48 49 50 51 51 52 53 54 55 55 55 56 57 58 59 60
[145] 60 60 61 62 63 63 64 65 65 66 67 68 68 69 70 71 72 73
[163] 74 75 76 77 78 79 80 80 81 82 83 84 85 86 86 87 88 89
[181] 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 106
[199] 106 107 107
Slot "tp":
[[1]]
[1] 0 1 2 3 3 4 4 4 5 6 7 8 9 10 10 11 12 13 14 15 16 17 17 18 19
[26] 20 21 22 23 24 25 26 27 28 29 30 30 31 32 33 33 34 35 36 37 38 39 40 41 42
[51] 43 44 45 45 45 46 47 48 49 50 50 51 51 52 53 54 55 56 56 57 58 59 60 61 62
[76] 62 63 64 65 66 66 67 68 69 70 70 71 72 73 74 75 76 77 77 78 79 79 79 79 79
[101] 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79
[126] 79 79 80 80 80 80 80 81 81 81 81 81 82 83 83 83 83 83 83 84 85 85 85 85 86
[151] 86 86 87 87 87 87 88 88 88 88 88 88 88 88 88 88 88 88 88 89 89 89 89 89 89
[176] 89 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 91 92 92
[201] 93
Slot "tn":
[[1]]
[1] 107 107 107 107 106 106 105 104 104 104 104 104 104 104 103 103 103 103
[19] 103 103 103 103 102 102 102 102 102 102 102 102 102 102 102 102 102 102
[37] 101 101 101 101 100 100 100 100 100 100 100 100 100 100 100 100 100 99
[55] 98 98 98 98 98 98 97 97 96 96 96 96 96 96 95 95 95 95
[73] 95 95 95 94 94 94 94 94 93 93 93 93 93 92 92 92 92 92
[91] 92 92 92 91 91 91 90 89 88 87 86 85 84 83 82 81 80 79
[109] 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61
[127] 60 60 59 58 57 56 56 55 54 53 52 52 52 51 50 49 48 47
[145] 47 47 46 45 44 44 43 42 42 41 40 39 39 38 37 36 35 34
[163] 33 32 31 30 29 28 27 27 26 25 24 23 22 21 21 20 19 18
[181] 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1
[199] 1 0 0
Slot "fn":
[[1]]
[1] 93 92 91 90 90 89 89 89 88 87 86 85 84 83 83 82 81 80 79 78 77 76 76 75 74
[26] 73 72 71 70 69 68 67 66 65 64 63 63 62 61 60 60 59 58 57 56 55 54 53 52 51
[51] 50 49 48 48 48 47 46 45 44 43 43 42 42 41 40 39 38 37 37 36 35 34 33 32 31
[76] 31 30 29 28 27 27 26 25 24 23 23 22 21 20 19 18 17 16 16 15 14 14 14 14 14
[101] 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14
[126] 14 14 13 13 13 13 13 12 12 12 12 12 11 10 10 10 10 10 10 9 8 8 8 8 7
[151] 7 7 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4
[176] 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1 1
[201] 0
Slot "n.pos":
[[1]]
[1] 93
Slot "n.neg":
[[1]]
[1] 107
Slot "n.pos.pred":
[[1]]
[1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[19] 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
[37] 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
[55] 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
[73] 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
[91] 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
[109] 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
[127] 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
[145] 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
[163] 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
[181] 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
[199] 198 199 200
Slot "n.neg.pred":
[[1]]
[1] 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183
[19] 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165
[37] 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147
[55] 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129
[73] 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111
[91] 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93
[109] 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75
[127] 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57
[145] 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39
[163] 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21
[181] 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3
[199] 2 1 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.