Accepted answer

Somewhere in your code (not shown here), there is a line which says f1_score = ... (with the written type being numpy.float64) so you're overriding the method f1_score with a variable f1_score (which is not callable, hence the error message). Rename one of the two to resolve the error.


Use metrics.f1_score(y_train,y_pred) instead of f1_score(y_train,y_pred) in this situation:

demo screenshot


Related Query

More Query from same tag