`best_precision, best_ap, best_f1 = precision, f1, ap` the position of f1 and ap should be switched @stoneMo