text: I am trying to classify some models in a binary classification. I want to classify the models with respect of score and f2 score.
  For the ‘score’ I used the code
  for name, clf in zip(models, classifiers): clf.fit(X_train, y_train) score = clf.score(X_test, y_test) scores.append(score)
  Which gives the scores of all the models, but I am not able to do it find the f2 score of all the models. Can anyone suggest what should be the code?
  Answer
  You can use the fbeta_score for this where you just set β equal to 2.
  from sklearn.metrics import fbeta_score scores = [] f2_score = [] for name, clf in zip(models, classifiers): clf.fit(X_train, y_train) y_pred = clf.predict(X_test) f2 = beta_score(y_test, y_pred, beta=2, average='binary') score = clf.score(X_test, y_test) scores.append(score) f2_score.append(f2)