# 023. Campaign ranking under capacity limits

**Question:** What precision and recall would observed rankings yield when reviewing a fixed fraction of records?

## Result

The largest computed metric is 1.805 for 0.2; the smallest is 1 for 1.0. Metric: lift (Lift versus random review).

This does not estimate the causal benefit of calling; all records come from past campaigns.

![Campaign ranking under capacity limits](outputs/chart.png)

| review_fraction | reviewed | precision | recall | lift |
| --- | --- | --- | --- | --- |
| 0.05 | 453 | 0.5342 | 0.08473 | 1.691 |
| 0.1 | 905 | 0.5326 | 0.1688 | 1.686 |
| 0.2 | 1809 | 0.5699 | 0.361 | 1.805 |
| 0.3 | 2713 | 0.5389 | 0.5119 | 1.706 |
| 0.5 | 4522 | 0.4027 | 0.6376 | 1.275 |
| 1 | 9043 | 0.3158 | 1 | 1 |

The chart shows 6 of 6 result rows; the table previews the first 6 in the analysis-defined order. [Download the full result table](outputs/results.csv). Numerical values are computed from the source; missing results stay unavailable.

## Method

Top-fraction lift curve using the fixed logistic model on later records.

The study uses shared source preparation and reusable statistical routines. Its specific transformations are in [analysis.py](analysis.py), and common model/evaluation code is in [portfolio/methods.py](../../portfolio/methods.py). The [notebook](analysis.ipynb) executes the study and displays the saved results.

## Evaluation

First 80% of ordered observations train; final 20% test. Training observations: 36,168; test observations: 9,043. Fixed models; default decision threshold; no holdout tuning.

Target: `subscribed`. Features: contact, month, day, campaign, pdays, previous, poutcome. Model results and row membership are recorded in [evaluation.json](outputs/evaluation.json).

## Decision and limitations

Choose a review capacity using operational costs and validate that choice on a fresh period.

Observational marketing records do not identify campaign uplift. Month and row order are not precise timestamps; repeated-client identifiers are unavailable. Models are research diagnostics, not financial eligibility or automated contact decisions. 

Related studies may share observations or holdouts. These are focused analytical studies, not independent replications or deployed business systems. Any model refinements informed by these results need new untouched evaluation data. No commercial impact is inferred from an association or backtest.

## Reproduce

From the repository root, after installing `requirements.txt`:

```powershell
python projects/023-campaign-ranking-under-capacity-limits/analysis.py
```

Source data are downloaded automatically if absent. Original archives are retained unchanged and checked by SHA-256. The cleaned cache normalizes column names; field-specific changes are visible in [data preparation](../../portfolio/data.py). Runtime evidence is in [receipt.json](outputs/receipt.json).

## Source

[Bank Marketing](https://archive.ics.uci.edu/dataset/222/bank+marketing), Moro, Rita and Cortez (2014). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/bank.json) and [prepared-data audit](../../data/provenance/bank_prepared.json) record the downloaded files, field coverage and hashes.
