I would greatly appreciate if you could let me know how to fix the following issue:

I used sklearn.metrics.fowlkes_mallows_score to compute G-mean score for my binary classification problem, but it produces nan:

AUC: 0.960674 
Accuracy: 0.949137 
Cohen Kappa: 0.484456 
F_measure: 0.508772 
G-mean: 0.833217 
G-mean1: nan 
Matthews: CorrCoef 0.510088 
Precision: 0.391892 
Recall: 0.725 

However, it should be: 0.533031

Thanks in advance.

  • 1
    $\begingroup$ Is it possible to put your data? $\endgroup$ Aug 21, 2018 at 13:21
  • $\begingroup$ @Media sorry, I can not put my data because it is not too small. However, this issue is also reported here: github.com/scikit-learn/scikit-learn/issues/8101 but I couldn't understand how to fix it. Thanks $\endgroup$
    – ebrahimi
    Aug 21, 2018 at 13:29
  • $\begingroup$ Have you tried to update it? $\endgroup$ Aug 21, 2018 at 14:13
  • $\begingroup$ @Media sorry I installed the latest version of scikit using anaconda. However, unfortunately the problem is not solved. $\endgroup$
    – ebrahimi
    Aug 22, 2018 at 5:38
  • $\begingroup$ I guess the issue may still be remained. $\endgroup$ Aug 24, 2018 at 13:29

2 Answers 2

from imblearn.metrics import geometric_mean_score

Docs are here.


The primary issue is that fowlkes_mallows_score is designed to evaluate clustering and you are trying to apply it to evaluate binary classification.

  • $\begingroup$ Thanks, could you please let me know how to compute G-mean score for binary classification? $\endgroup$
    – ebrahimi
    Sep 24, 2021 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.