Description Usage Arguments Details References Examples
Calculate Matthews correlation coefficient
| 1 2 3 4 5 6 7 8 9 | 
| preds | A vector of prediction values, or a data.frame or matrix of TRUE/FALSE or 1/0 whose columns correspond to the possible classes | 
| actuals | A vector of actuals values, or a data.frame or matrix of TRUE/FALSE or 1/0 whose columns correspond to the possible classes | 
| TP | Count of true positives (correctly predicted 1/TRUE) | 
| FP | Count of false positives (predicted 1/TRUE, but actually 0/FALSE) | 
| TN | Count of true negatives (correctly predicted 0/FALSE) | 
| FN | Count of false negatives (predicted 0/FALSE, but actually 1/TRUE) | 
| confusionM | Confusion matrix whose (i,j) element represents the number of samples with predicted class i and true class j | 
Calculate Matthews correlation coefficient. Provide either
preds and actuals or
TP, FP, TN, and FN
confusionM
https://en.wikipedia.org/wiki/Matthews_correlation_coefficient
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | preds <- c(1,1,1,0,1,1,0,0)
actuals <- c(1,1,1,1,0,0,0,0)
mcc(preds, actuals)
mcc(actuals, actuals)
mcc(TP=3, FP=2, TN=2, FN=1)
# Multiclass
preds <- data.frame(
  setosa = rnorm(n = 150), 
  versicolor = rnorm(n = 150), 
  virginica = rnorm(n = 150)
)
preds <- preds == apply(preds, 1, max)
actuals <- data.frame(
  setosa = rnorm(n = 150), 
  versicolor = rnorm(n = 150), 
  virginica = rnorm(n = 150)
)
actuals <- actuals == apply(actuals, 1, max)
mcc(preds = preds, actuals = actuals)
# Confusion matrix
mcc(confusionM = matrix(c(0,3,3,3,0,3,3,3,0), nrow = 3))
mcc(confusionM = matrix(c(1,0,0,0,1,0,0,0,1), nrow = 3))
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.