Create Session Sequence Features for Purchase Prediction From Clickstream
Last updated: November 29, 2026
Quick Overview
Using clickstream events within a browsing session (search, product view, add to cart, remove, review read), design features that predict whether the session ends in a purchase, and explain how you would compute them in near real time.
Amazon
November 29, 20260
0
0 solved
Using clickstream events within a browsing session (search, product view, add to cart, remove, review read), design features that predict whether the session ends in a purchase, and explain how you would compute them in near real time.
In-session intent signals help Amazon decide what to show next, such as recommendations or a coupon. The interviewer checks whether you can turn raw event sequences into informative features, and whether those features can be computed within a latency budget at serving time.
What the Interviewer Expects
- Defines session boundaries and the prediction point within a session
- Builds count, ratio, recency and order-aware features
- Captures funnel progression such as view to cart transitions
- Considers learned sequence representations as an alternative
- Explains streaming computation and training-serving parity
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- How do you avoid features that encode the purchase itself?
- Would you use an RNN or transformer instead of handcrafted features?
- How do you handle sessions across devices?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
Ask when the prediction is made (after every event, or at a fixed time in the session), what defines a session (30 minutes of inactivity), and the latency budget (tens of milliseconds)....
Approach
Predict at each event using only events so far. Combine three kinds of features: aggregate counts within the session, order-aware features that reflect progress through the funnel, and context feature...