# 020. Pre-call subscription benchmark

**Question:** Can contact context and prior campaign history predict subscription without call duration?

## Result

The largest computed metric is 0.4818 for Logistic regression; the smallest is 0.3158 for Prior baseline. Metric: average_precision (Average precision).

Duration, demographics and financial account fields are excluded. Row order is a coarse chronological proxy.

![Pre-call subscription benchmark](outputs/chart.png)

| model | accuracy | balanced_accuracy | macro_f1 | roc_auc | average_precision | brier |
| --- | --- | --- | --- | --- | --- | --- |
| Prior baseline | 0.6842 | 0.5 | 0.4062 | 0.5 | 0.3158 | 0.2779 |
| Logistic regression | 0.6806 | 0.5272 | 0.4906 | 0.6632 | 0.4818 | 0.2353 |
| Random forest | 0.683 | 0.5036 | 0.4214 | 0.674 | 0.4641 | 0.2365 |

The chart shows 3 of 3 result rows; the table previews the first 3 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

Fixed logistic and forest benchmarks against a prior baseline on the final source-order fifth.

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

Evaluate ranking and calibration before considering a consent-aware operational pilot.

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/020-pre-call-subscription-benchmark/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.
