Building Effective Metrics to Describe Users

Vladimir Zhyvov8 Jan 2025

Problem

Analysts building a customer profile usually store raw numbers: spend over 30 days, purchases, days since the last purchase. These numbers ignore the user's own history, so $200 means different things for different users and at different lifecycle stages. The profile feeds insights, ML features and offer rules, so a misleading number leads to the wrong action. The goal is a normalized score that shows how typical a value is for this user, without black-box models.

Example from the article: an e-commerce platform wants to send a discount email to users whose activity last week was lower than in their previous weeks. For a user named John, the question is whether 6 visits last week is unusually low for him.

Solution in brief

Build the empirical cumulative distribution function (CDF) of the user's own past metric values and interpolate it monotonically. Read it at the current value: the result is a personal p-value from 0 to 1 that can be compared with a threshold and across users.

Questions this case answers
  • How to judge whether an entity's current metric value is extreme relative to its own history when the metric is not normally distributed and the result must stay interpretable
  • How to normalize a numeric behavioral metric to a common 0–1 scale so that entities with different baselines become comparable
  • How to tell whether a user's metric value, such as 3 visits last week, is unusual for that particular user?
  • How to turn raw user metrics into scores that can be compared between users without a black-box model?

Tools and methods

  • Empirical CDF per user — probability of a value at or below a level, from the user's own history
  • Piecewise Cubic Hermite Interpolating Polynomial (PCHIP) — interpolates the CDF and keeps it monotone
  • Personal p-value threshold — cutoff on the CDF value (0.1 in the example) to trigger an action
  • SciPy, NumPy — PchipInterpolator, sorting and cumulative sums
Continue reading — it's free

Google or a one-time email code. No password.