KatInterview

Separating Automated Traffic from a Sudden Active-User Surge

Statistics & ExperimentsModel answer
MediumModel answerStatistics & Experimentsnegative-binomialmixture-modelsbootstrap

Last updated

Estimate how much of a short-term rise in daily active users comes from scripts rather than people, model overdispersed login counts, quantify uncertainty, and handle heavy-tailed comparisons.

Scenario

You work as a data scientist for a large consumer app. Over the last 48 hours, daily active users (DAU) rose by about 20% relative to normal. The product team thinks the jump may come from automated scripts, such as scrapers or CI test runners, rather than real growth in human usage.

Available data

  • Hourly login counts for the past 60 days.
  • The user-agent string for every login event.
  • A per-user flag showing whether the user passed a "human-only" step, such as a CAPTCHA or a UI interaction that needs realistic latency.

Questions

  1. Describe a statistical framework to estimate the share of automated versus human traffic during the surge. Which distribution would you use for the login counts, given that their variance is larger than their mean?
  2. How would you quantify the uncertainty in your estimate of the automated-to-human ratio?
  3. Suppose automated accounts have heavy-tailed activity. Why might a standard two-sample t-test be a poor way to compare average activity between suspected automated and verified human accounts, and what would you use instead?

Follow-up to address

Suppose you write daily logins as Y = p * Bot + (1 - p) * Human, with the human part assumed Poisson, yet the data show much more variance than a Poisson allows. What would you change?

Hints

Hint 1

Separate two questions: how many logins exceed the expected baseline (an aggregate, time-series question), and which users are automated (a classification or composition question). Use independent methods for each and compare.

Hint 2

Poisson forces variance to equal the mean. Think about a Poisson model whose rate itself is random (Gamma-distributed), and about covariates such as hour of day and day of week that the baseline must account for.

Hint 3

The human-only flag is imperfect: some humans skip it and some bots pass it. If you know its pass rate for humans and for bots, the observed pass rate during the surge is a linear function of the bot share that you can invert.

Hint 4

For uncertainty, ask what is correlated: events within a user, and hours within a day. Resample at the level of those clusters or blocks, and build the interval on a scale where the ratio is stable.