Skip to content
ML Academy

Classical ML, validation, metrics, interpretation, debugging · insight-1172

Model counts per exposure with a log-exposure offset instead of raw counts or an unweighted rate

Evidence type
documented fact
Difficulty
medium
Roles
Data scientist
Industries
insurance, manufacturing, aviation

Summary: situation, action, reason, boundary

  1. Situation

    Counts of no-shows, claims or defects accrue over very different amounts of exposure: flights flown, policy-years, machine-hours.

  2. Action

    Fit a Poisson or negative binomial GLM with a log link and log(exposure) as an offset (the exposure argument in statsmodels), or in scikit-learn model counts divided by exposure with exposure as sample weight. Predict expected counts as rate times exposure.

  3. Reason

    With a log link, log(mean) = log(exposure) + X beta, so mean counts scale proportionally and coefficients are rate ratios.

  4. Boundary

    Claim frequency, defect and incident counts, any event count with unequal observation windows.

Symptom or risk

Raw counts let exposure leak into coefficients so big units look risky; an unweighted rate gives a 3-flight route the same say as a 3,000-flight route and is undefined at zero exposure.

Exceptions

Identical exposure across rows, where the offset folds into the intercept.

Trade-offs

Assumes risk is proportional to exposure; add log(exposure) as a free covariate when it is not.

Pitfalls

Supplying exposure with a non-log link, which statsmodels does not allow, or adding the same exposure as both offset and ordinary feature without noticing.

Lessons and concepts

Claims and their sources