Precision is the ratio between the true positives and all predicted positives: precision = TP / (TP + FP). The denominator counts every case the model labeled positive, right or wrong, so precision answers one question: when the model says yes, how often is it right?
Example: a drug-screening model scores 10,000 compounds and sends its top 40 to the lab. Twelve turn out to be active, so precision is 12 / 40 = 0.30. If each assay costs $2,000, each confirmed hit costs $2,000 / 0.30 ≈ $6,667, so precision sets the cost per success. Active compounds ranked below the cutoff never enter the ratio.
Precision and recall share the numerator TP. With actual classes in rows and predictions in columns, as scikit-learn prints a confusion matrix, precision divides by the predicted-positive column and recall by the actual-positive row; in a multi-class matrix, a class's precision is its diagonal cell over its column total. In measurement science, precision means something else: how closely repeated measurements agree.