# Logistic scores, thresholds and confusion matrices

> A logistic model maps a real score through σ(z)=1/(1+exp(−z)). Interpreting a score as a reliable probability requires calibration assessment.

Course: [Mathematics of machine learning](https://studybrix.com/en/courses/machine-learning-mathematics/index.md)
Level: university
Prerequisites: Probability, ratios and model evaluation.

## Notes

### Score

A logistic model maps a real score through σ(z)=1/(1+exp(−z)). Interpreting a score as a reliable probability requires calibration assessment.

### Threshold

A binary decision compares a score with a stated threshold. Changing the threshold can trade false positives against false negatives.

### Metrics

Precision is TP/(TP+FP); recall is TP/(TP+FN). A zero denominator requires explicit handling rather than silent division.

### F1

F1=2TP/(2TP+FP+FN) where defined. It summarizes a tradeoff but does not incorporate every application-specific cost.

## Practice questions

### 1. Find σ(0) for the logistic sigmoid.

Answer: 0.5

Explanation: 1/(1+exp(0))=1/2.

### 2. With TP=12 and FP=3, find precision.

Answer: 0.8

Explanation: 12/(12+3)=0.8.

### 3. With TP=12 and FN=8, find recall.

Answer: 0.6

Explanation: 12/(12+8)=0.6.

### 4. What is a false positive?

A. Predicted negative and actually positive
B. Correct negative
C. Correct positive
D. Predicted positive but actually negative

Answer: Predicted positive but actually negative

Explanation: The predicted class is positive and the true class is negative.

### 5. For TP=6, FP=2, FN=4, find F1.

Answer: 2/3

Explanation: F1=12/(12+2+4)=12/18.

### 6. Why can lowering a threshold increase recall while reducing precision?

Sample answer / marking guidance: More examples are labelled positive, potentially capturing missed positives while also admitting more false positives. The exact change depends on the data.

Explanation: Credit both effects without claiming strict monotonic precision in every finite set.

### 7. Should a metric with zero denominator be silently reported as an ordinary exact value?

A. Yes, always report −1
B. Yes, always report 1
C. Only when the chart is blue
D. No; use an explicit convention and disclose it

Answer: No; use an explicit convention and disclose it

Explanation: Undefined cases need an explicit evaluation convention.

### 8. Why should a threshold be selected using validation rather than repeated final-test tuning?

Sample answer / marking guidance: Threshold selection is model selection. Using test outcomes for it contaminates the independent evaluation.

Explanation: Credit selection and leakage.

## Further reading

- https://developers.google.com/machine-learning/crash-course
- https://cs229.stanford.edu/

Original AI-assisted educational draft; not independently teacher-reviewed. References support further study, not copied exercises, affiliation or curriculum accreditation.
