Feature Engineering to Predict Which API Customers Will Churn

Last updated: November 29, 2026

Quick Overview

You are building a model that predicts which paying API organizations will stop spending within the next 30 days, so the account team can reach out. Define the label and describe the features you would build from usage, billing, and error logs, and how you would avoid leakage.

OpenAI
Machine Learning
Data Scientist
OpenAI
November 29, 2026
Data Scientist
Technical Screen
Machine Learning
Easy

0

0

0 solved


You are building a model that predicts which paying API organizations will stop spending within the next 30 days, so the account team can reach out. Define the label and describe the features you would build from usage, billing, and error logs, and how you would avoid leakage.

OpenAI's API business has customers ranging from hobbyists to large enterprises with very different usage shapes. The interviewer checks whether the candidate can turn raw logs into predictive, leakage-free features and define a label that matches the business action.

What the Interviewer Expects
  • Defines churn precisely with a prediction date and horizon
  • Builds trend and ratio features, not only raw totals
  • Uses product specific signals like rate limit hits and model migrations
  • Computes every feature strictly before the prediction date
  • Normalizes for customer size
Key Topics to Cover
feature engineering
churn prediction
label definition
data leakage
time windows
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • How would you handle customers whose usage is naturally seasonal or batchy?
  • How would you evaluate whether outreach based on this model actually saves revenue?
  • Which features would you expect to be misleading, and why?
  • How would you explain a prediction to an account manager?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Churn label: an org with at least $100 spend in the 30 days before prediction date tt whose spend in (t,t+30](t, t+30] falls below 10 percent of that. A hard zero misses customers who drift to a competito...

Approach

Features computed only from data before tt, grouped by signal:

  • Volume and trend: tokens and spend over the last 7, 30, and 90 days; ratio of last 7 to prior 28 days; slope of a regression of da...

Submit Your Answer
Markdown supported