Data Science Asked by Vilanova on May 26, 2021
I want to calculate MCC, I have two CSV files: result.csv and true.csv
result.csv format:
id | prob_class1 | prob_class2 | prob_class3 | prob_class4
1 |0.34 | 0.4 | 0.32 |0.77
2 |0.84 | 0.4 | 0.2 |0.7
true.csv format:
id | prob_class1 | prob_class2 | prob_class3 | prob_class4
1 |0 | 0 | 1 |0
2 |0 | 1 | 0 |0
3 |0 | 0 | 0 |1
result.csv is the output of the multi-classification problem, true.csv is the true result. How I can calculate the Matthews Correlation Coefficient?
Here are the high-level steps:
sklearn.metrics.matthews_corrcoef
. Answered by Brian Spiering on May 26, 2021
from sklearn.metrics import matthews_corrcoef
y_true = [+1, +1, +1, -1]
y_pred = [+1, -1, +1, +1]
matthews_corrcoef(y_true, y_pred)
Source:
https://scikit-learn.org/stable/modules/generated/sklearn.metrics.matthews_corrcoef.html
Answered by fuwiak on May 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP