Complexa Labs
Back to experience
Staffing · €3B+ European staffing group

B2B customer segmentation & next-best-product recommender

Lead quantitative engineer · 2024 – present

The problem

The client serves tens of thousands of B2B accounts across temporary staffing, permanent placement, outsourcing, training, and HR consulting. The commercial organisation was operating on sector-and-headcount heuristics: rules of thumb that grouped clients into segments without any principled estimate of how much each relationship would actually be worth, how long it would last, or which adjacent service should be offered next.

Two interlocking deliverables came out of the engagement: a customer lifetime value pipeline that put a calibrated number — with uncertainty — on every active client, and a next-best-product recommender that decides which service to propose, to whom, and when.

1 · The CLTV pipeline

Mixture cure survival

Standard survival models assume every client eventually churns. In B2B staffing this is wrong: a meaningful share of clients form indefinitely-active relationships, and forcing a Weibull or Cox model onto them inflates churn risk and depresses LTV across the entire book. A mixture cure model separates two latent populations — the "cured" clients who are functionally permanent and the "susceptible" clients who will churn on a estimable timeline — and fits both jointly. This gave the commercial team two numbers per client (cure probability and conditional survival curve) instead of one opaque churn score.

Quantile regression for margin uncertainty

Average-margin point estimates are the wrong object when sales decisions are loss-averse. We fit quantile regression across the margin distribution (10th / 50th / 90th percentile) per client and contract type. The commercial team now sees a margin band rather than a single number — and can decide whether to chase a deal based on its downside, not just its mean.

GBM ensembles for cross-sell propensity

Gradient-boosted ensembles (LightGBM, with monotone constraints on a handful of intuitive features and cluster-bootstrap confidence intervals) generate per-product propensity scores from billing history, placement counts, sector, and macro indicators. These feed the segmentation layer and seed the NBP recommender below.

Calibrated A/B testing framework

A bespoke experimentation harness sits on top of the modelling stack:

  • Stratified re-randomisation on a balance score over pre-treatment covariates, eliminating the chance imbalance that plagues simple Bernoulli assignment in heavy-tailed B2B panels.
  • CATE analysis via causal forests on the resulting experiments — so we recover not just average treatment effects but the conditional heterogeneity that justifies (or kills) a roll-out decision.
  • Power calculations grounded in the historical client variance, so experiments are sized to detect economically meaningful effects rather than statistically convenient ones.

2 · The next-best-product recommender

The second deliverable extends segmentation into recommendation: given a client's current state, which service should the salesforce propose next? Off-the-shelf propensity scorers fail in this setting for four reasons — statelessness, no sequential dynamics, confounding of correlation with causation, and the deployment-feedback loop in which the recommender itself becomes part of the data-generating process.

A causal state-space approach

The recommender treats each client as carrying a latent vector of need intensities across the product portfolio. Purchase events enter as exogenous shocks through a structured transition matrix whose non-zero entries encode genuine cross-product mechanisms rather than the spurious co-occurrence that confounds correlation-based scorers.

Identification via quasi-experimental designs

The cross-product effects are identified offline through quasi-experimental designs, not through joint maximum-likelihood (which would re-confound them):

  • Staggered Callaway–Sant'Anna difference-in-differences for most cross-product edges, using the natural rollout of products across clients as the source of identifying variation.
  • Regression discontinuity on regulatory headcount thresholds where statutory cutoffs generate sharp, exogenous shifts in incentives.
  • Each fitted edge carries a point estimate, a customer-cluster bootstrap confidence interval, a pre-trend diagnostic, and a status flag controlling how much downstream inference trusts each pathway.
  • A tiered variant splits the same fit by client size, exposing effect heterogeneity that a global average would smear out.

Online inference

Client trajectories are tracked through a Rao–Blackwellised particle filter that samples the regression coefficients, latent state, and transition matrix jointly per particle — letting the causal pathways drift over time as the market evolves.

Why this matters in deployment

Because cross-product effects are identified causally rather than correlationally, the recommender remains valid once its scores start shaping sales actions. A correlational model degrades the moment it becomes part of the data-generating process; a causally-identified one does not.

Outcomes

  • A calibrated client-level LTV with explicit margin uncertainty replaces sector heuristics across the entire B2B book.
  • The NBP recommender ships with a documented offline evaluation harness — including saturation adjustment, propensity-weighted lift estimates, and tier-conditional metrics — closing the loop between research and production.
  • The methodology paper is published as a Complexa Labs working paper (Causal State-Space Models for Next Best Product Recommendation, 2026).

Stack

Python · Polars · NumPy · scikit-learn · LightGBM · scipy · statsmodels · custom particle filter · Spark for ingest · MongoDB / Azure for storage · FastAPI + Celery for serving.