## Machine Learning: Predicting Engagement Likelihood

We train a supervised machine learning layer that answers one core question for each HCP × channel combination: **"If we contact this HCP through this channel in the upcoming cycle, how likely are they to engage?"**

### What We Do

- **Target**: Binary classification - `successful_engagement` (0/1)
- **Features**: All engineered features (HCP profile, rolling windows, Rx, 
  trends) — approximately 30 features per model
- **Algorithm**: Gradient Boosting (XGBoost / LightGBM via Dataiku AutoML)
- **Training data**: Historical engagement attempts with known outcomes, 
  using only data up to T−1 for each observation

### Single Model, Single Score

Rather than training separate models per time horizon, this solution trains a single Gradient Boosting classifier that predicts the probability of successful engagement for each HCP × channel pair. The model learns from the full engagement history and produces one score per candidate action, which feeds directly into the optimizer.

**Model performance**: AUC 0.745 · Classification threshold 0.375 · Recall 82%

**Key drivers** (by feature importance):
- Channel type (17%)
- Lifetime channel successes (12%)
- Days since last channel success (11%)
- Recent Rx volume (6%)
- Days since last channel attempt (4%)
- Account tenure (3%)


### What the Model Outputs

For every HCP × channel pair in the scoring dataset the model produces:

- `engagement_probability` — predicted probability of successful engagement
- `engagement_tier` — binned label: high / medium / low
- SHAP values — per-feature attributions explaining each individual 
  prediction, routed to the LLM explainability step

Example output for a single HCP across all five channels:

| HCP | Channel | p(engage) | Exp. Lift |
|---|---|---|---|
| Dr. Rhodes | phone_call | **0.55** | 5.0% |
| Dr. Rhodes | webinar | 0.48 | 5.8% |
| Dr. Rhodes | rep_visit | 0.31 | 5.6% |
| Dr. Rhodes | email | 0.22 | 0.9% |
| Dr. Rhodes | digital_ad | 0.14 | 0.3% |

The optimizer selects phone call as the recommended action - highest engagement probability and strong expected lift relative to cost. If phone call capacity is exhausted, the next best option is a webinar based on expected lift. Timing emerges naturally from the weekly re-run of the optimizer rather than from separate time-horizon models.

### Cold Start

HCPs with fewer than 3 attempts on a given channel have insufficient history for reliable individual predictions. We recommend falling back to average success rates from similar HCPs of the same segment/ same channel, as a starting point, until enough personal history has accumulated to use the individual model.