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 sample
According to @Shovalt's answer, but in short:
Alternatively you could use the following lines of code
from sklearn.metrics import f1_score
metrics.f1_score(y_test, y_pred, labels=np.unique(y_pred))
This should remove your warning and give you the result you wanted, because it no longer considers the difference between the sets, by using the unique mode.