KatInterview

Designing a Time-Aware Model for User Conversion Prediction

Machine LearningModel answer
MediumModel answerMachine Learningtime-seriesimbalanced-datafeature-engineering

Last updated

Design an ML system to forecast user purchase likelihood while handling temporal constraints, severe class imbalance, and business-driven precision requirements.

Problem Context

You're building a prediction system to estimate the probability that a platform visitor will complete a purchase for a specific item within one week of their initial view. Your dataset includes timestamped engagement records, product metadata, and conversion outcomes.

Your Task

Address these four aspects of the ML pipeline:

1. Temporal Validation Design

Design a cross-validation approach that accounts for the time-ordered nature of events and prevents information leakage from future data into training.

2. Feature Construction

Identify and describe three separate feature categories you would extract from user activity logs. Explain your strategy for ensuring no future information contaminates historical feature values.

3. Threshold Calibration for Business Goals

The conversion rate in your dataset is 2%. The product team needs high precision—they want to minimize wasted outreach to users unlikely to convert. Walk through your approach to selecting an operating threshold and the metrics you would prioritize.

4. Production Monitoring

Specify two distinct monitoring signals you would track after deployment to catch degradation caused by shifting user patterns or external factors.

Data Characteristics

  • Records: UserID, ProductID, ViewTimestamp, Converted (binary target)
  • Key constraint: Features must reflect only information available at the moment of the view—no retroactive signals from later events

What We're Looking For

A practical pipeline design that shows you understand:

  • How time dependencies create leakage risks
  • Techniques for working with severe class imbalance
  • Connecting model outputs to business decisions
  • Operational concerns in live systems

Hints

Hint 1

Consider what happens to the label of a view from 3 days ago—can you use it for training yet?

Hint 2

With 2% positive rate, what does a naive 'always predict no' baseline achieve?

Hint 3

How would you compute 'user's historical purchase count' without including purchases that happened after the current view?