How can I get an MCC score?

Hi guys,

I’m new to XGBoost, so I had a previous model based on Logistic Regression and I had a low MCC score, I then used XGBoost which improved my accuracy overall but I don’t know how to incorporate MCC score with XGBoost.


For training there are many examples of adding MCC to eval_metric
If it is solely to predict

Install generalized_matth
and run the following

from generalized_matth.matt_funct import matthew_multiclass

def calc_matt(y_true, y_pred):
mm = matthew_multiclass(y_true, y_pred )
return mm.main_matthew_mult_class()
if name==‘main’:

y_p = my_model.predict(my_test_data_x)
print("  Matt:", calc_matt(my_test_data_y, y_p))