performance | R Documentation |
Compute sensitivity, speciticity, precision, F1 score, and accuracy for a set of predictions.
performance(obs = NULL, pred = NULL, C = NULL, y = "0,1", ...)
obs |
A vector of observed values. |
pred |
A vector of predicted values. |
C |
2x2 contingency table (alternative to |
y |
Contingenty table orientation. If |
... |
Currently ignored. |
A list of 6 objects:
"ctable", 2x2 contingency table of predicted vs. observed values;
"sensitivity", Se = TP/(TP + FN);
"specificity", Sp = TN/(TN + FP);
"precision", PPV = TP/(TP + FP), also called "positive predictive value";
"NPV", NPV = TN/(TN + FN), "negative predictive value";
"F1", F1 = 2*Se*PPV/(Se + PPV);
"accuracy", (TP + TN)/(TP + TN + FP + FN).
Fernando Palluzzi fernando.palluzzi@gmail.com
us.predict
# RBM performance p <- predict(mpm.rbm$fit, dichotomize(mpm.us[2:15], asFactor = TRUE), type = "response") y.hat <- ifelse(p > 0.5, 1, 0) rbm <- performance(mpm.us$y, y.hat) # Compare RBM and RFC F1 scores print(rbm$F1) print(mpm.rfc$performance$F1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.