mcc: Matthews correlation coefficient

View source: R/metrics.R

mccR Documentation

Matthews correlation coefficient

Description

Calculates Matthews correlation coefficient (MCC) which is in essence a correlation coefficient between the observed and predicted binary classifications. It has also been generalised to multi-class classification.

Usage

mcc(cm)

mcc_multi(cm)

Arguments

cm

A contingency table or matrix of predicted vs observed classes with reference classes in columns and predicted classes in rows.

Details

Use mcc() for 2x2 tables (binary classification). mcc_multi() is for multi-class classification with k x k tables and is calculated using Gorodkin's method.

Value

Returns a value between -1 and +1. A coefficient of +1 represents a perfect prediction, 0 no better than random prediction and -1 indicates total disagreement between prediction and observation.

References

Gorodkin, J. (2004). Comparing two K-category assignments by a K-category correlation coefficient. Computational Biology and Chemistry. 28 (5): 367–374.


nestedcv documentation built on Sept. 11, 2024, 5:22 p.m.