This documentation is for scikit-learn version 0.10Other versions

Citing

If you use the software, please consider citing scikit-learn.

This page

8.16.1.6. sklearn.metrics.fbeta_score

sklearn.metrics.fbeta_score(y_true, y_pred, beta, pos_label=1)

Compute fbeta score

The F_beta score is the weighted harmonic mean of precision and recall, reaching its optimal value at 1 and its worst value at 0.

The beta parameter determines the weight of precision in the combined score. beta < 1 lends more weight to precision, while beta > 1 favors precision (beta == 0 considers only precision, beta == inf only recall).

Parameters :

y_true : array, shape = [n_samples]

true targets

y_pred : array, shape = [n_samples]

predicted targets

beta: float :

pos_label : int

in the binary classification case, give the label of the positive class (default is 1). Everything else but ‘pos_label’ is considered to belong to the negative class. Not used in the case of multiclass classification.

Returns :

fbeta_score : float

fbeta_score of the positive class in binary classification or weighted avergage of the fbeta_score of each class for the multiclass task.

See also

R., Addison, pp.

http
//en.wikipedia.org/wiki/F1_score