Fix Python – UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples
I’m getting this weird error:
classification.py:1113: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
‘precision’, ‘predicted’, average, warn_for)`
but then it also prints the f-score the first time I run:
metrics.f1_score(y_test, y_pred, average=’weighted’)
The second time I run, it prov….