6.9.5. scikits.learn.metrics.precision_score¶
- scikits.learn.metrics.precision_score(y_true, y_pred, pos_label=1)¶
Compute the precision
The precision is the ratio where tp is the number of true positives and fp the number of false positives. The precision is intuitively the ability of the classifier not to label as positive a sample that is negative.
The best value is 1 and the worst value is 0.
Parameters : y_true : array, shape = [n_samples]
true targets
y_pred : array, shape = [n_samples]
predicted targets
pos_label : int
in the binary classification case, give the label of the positive class (default is 1)
Returns : precision : float
precision of the positive class in binary classification or weighted avergage of the precision of each class for the multiclass task