Matthews Correlation Coefficient
Statistical Inference DS practice problem on Onlearn.
Difficulty: medium.
Topics: Understanding Classification Metrics for Imbalanced Datasets, True Positive Rate, False Positive Rate, Denominator Zero-Division Handling, Phi Coefficient calculation, Contingency Table Construction, Probability & Statistics, Statistical Inference, Binary Classification, Information Theory, Performance Evaluation, Confusion Matrix Analysis, Type I and Type II Errors, Imbalanced Data Handling, Correlation Coefficients, Model Validation Metrics.
Implement a function to calculate the Matthews Correlation Coefficient (MCC) for a binary classification task. The function should take two lists: 'y true' (ground truth labels) and 'y pred' (predicted labels). MCC is a correlation coefficient between the observed and predicted binary classifications; it returns a value between 1 and +1, where +1 represents a perfect prediction, 0 no better than random, and 1 total disagreement.