/api/uplift_model

Header
X-Customer-Api-Id: <uuid>
X-Secret:          <secret>
Content-Type:      application/json
Request Body Schema
{
  "contamination": float,       // optional, 0.0–1.0 share of control exposed
  "rows": [                     // required, min 200 entries
    {
      "id": string,             // customer identifier
      "treatment": 0|1,         // 1 = received campaign
      "outcome": 0|1,           // 1 = converted/purchased
      "features": {             // any numeric or categorical predictors
        "<feature_name>": number|string,
        …
      }
    }
    // … repeat for each customer …
  ]
}
Example Request Body
// Example Request (stub; include ≥200 such rows)
{
  "contamination": 0.15,
  "rows": [
    { "id": "C-001", "treatment": 1, "outcome": 1, "features": { "age": 34, "country": "BR", "prior_purchases": 2 } },
    { "id": "C-002", "treatment": 0, "outcome": 0, "features": { "age": 27, "country": "US", "prior_purchases": 0 } },
    { "id": "C-003", "treatment": 1, "outcome": 1, "features": { "age": 42, "country": "UK", "prior_purchases": 3 } },
    // … ≥197 more rows …
  ]
}
Example Response Body
// Example Response
{
  "average_treatment_effect": 0.3857,
  "treatment_cr": 0.6381,
  "control_cr": 0.2571,
  "decile_summary": [
    { "decile": 1, "mean_uplift": -0.9986, "n_customers": 21 },
    { "decile": 10, "mean_uplift": 0.9999,  "n_customers": 21 }
    // … deciles 2–9 …
  ],
  "details": [
    { "id": "C-001", "uplift_score": 0.0000, "uplift_decile": 3 },
    { "id": "C-002", "uplift_score": 0.9998, "uplift_decile": 9 },
    { "id": "C-003", "uplift_score": 0.9913, "uplift_decile": 6 }
    // … one entry per input row …
  ],
  "interpretation": "Treatment group converted at 63.81% vs control 25.71% (ATE +0.386). Top decile yields +1.000 uplift per customer—ideal to target; bottom decile shows negative lift—ideal hold-out."
}
Description

average_treatment_effect: Global incremental lift (>0 → campaign effective). treatment_cr / control_cr: Conversion rates by cohort. decile_summary: Mean uplift & size for each 10% bucket. details: Per-customer uplift_score & decile for targeting.

Business Usage

Email marketing: Send only to top-2 uplift deciles (–30% sends, flat orders). Discount allocation: Offer incentives to high-uplift customers, preserve margin on low uplift. A/B hold-out: Use bottom decile as control for statistically sound lift measurement.

← Back to all routes