File size: 1,988 Bytes
2ca0c19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
You are an agent, your current working directory is /app.

You can use the tools available to you to interact with the computer to assist the user in completing tasks.

# Repair campaign-outcome validation in uplift evaluation

Work in `/app/vendor/scikit-uplift`, a frozen source tree for a real marketing uplift library. Its treatment-aware metrics correctly require two binary campaign arms, but malformed non-binary response outcomes currently flow into incrementality calculations and plots.

Diagnose and repair the existing implementation. The repair must be made in both `sklift/metrics/metrics.py` and `sklift/viz/base.py`; do not replace the library with a separate evaluator, coerce response values, or special-case the supplied fixture.

The public behavior is:

- Every metric entry point that accepts `y_true` must reject response arrays containing values outside binary `0` and `1` with `ValueError` before computing cohort statistics.
- Every plotting entry point that accepts `y_true` must perform the same validation locally, before delegating to metric helpers or constructing misleading diagnostics.
- Existing consistent-length validation and binary treatment validation must remain in force.
- Valid binary campaigns must retain the existing model, uplift/Qini curve, AUC, percentile, and plotting behavior.
- Keep the frozen source and existing tests intact except for the two designated production modules.

After repairing the source, run the supplied end-to-end workflow:

```sh
python3 /app/tools/run_campaign_evaluation.py --output /app/campaign_evaluation.json
```

The command must complete offline. `/app/campaign_evaluation.json` must use `output_schema_version` `sklift.campaign-evaluation.v1`, record the three workflow stages, contain the valid campaign's model predictions, curves, scores, percentile table and plot titles, record each malformed campaign case as rejected with `ValueError`, and list the five source modules exercised by the workflow.