August 2018
Intermediate to advanced
522 pages
12h 45m
English
A weighted harmonic mean between precision and recall is provided as follows:

A beta value equal to 1 determines the so-called F1 score, which is a perfect balance between the two measures. A beta less than 1 gives more importance to precision and a value greater than 1 gives more importance to recall. The following snippet shows how to implement this with scikit-learn:
from sklearn.metrics import fbeta_scoreprint(fbeta_score(Y_test, lr.predict(X_test), beta=1))0.968print(fbeta_score(Y_test, lr.predict(X_test), beta=0.75))0.964print(fbeta_score(Y_test, lr.predict(X_test), beta=1.25))0.972
Read now
Unlock full access