Notebook Exercise: Predict Post Clicks From Time Spent on Three Topics

Quick Overview

A live notebook exercise: explore a dataset whose three features are a user's time spent on three Reddit topics, then train a binary classifier predicting whether the user clicks a post. It tests numpy and pandas exploration, scikit-learn pipelines, validation discipline, metric choice and model interpretation.

Notebook Exercise: Predict Post Clicks From Time Spent on Three Topics

Company: Reddit

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Technical Screen

In a live coding screen you receive a link to a notebook and share your full screen while you work. The notebook poses a binary classification problem: predict whether a user will click a given Reddit post. The dataset has three features, each the time the user has spent on one of three Reddit topics, and a label saying whether the user clicked. Explore the data with numpy (pandas is fine too), then train and evaluate a binary classifier with scikit-learn, explaining your choices as you go. ### Clarifying Questions - How many rows are there, and how imbalanced is the label? - What are the units of the time features (seconds, minutes), and over what period were they measured? - Does each row describe one user and one post? Is the post's own topic, or any post or user identifier, available, or is every row about the same post? - Can one user appear in many rows? - Which metric matters most to you: accuracy, ROC AUC, or something tied to how the predictions would be used? - Which libraries may I use, and may I look up documentation? ### Part 1 — Explore the data Inspect the dataset before modeling and report what you find. ```hint What time spent looks like Before modeling, check the shape of each time-spent distribution and what fraction of users spent no time at all on a topic. ``` #### What This Part Should Cover - Shape, types, missing values, duplicates and impossible values - The label's base rate - Each feature's distribution (skew, zeros, outliers) and its relationship with the click rate ### Part 2 — Train a classifier Split the data and train at least one classifier with scikit-learn. ```hint A number to beat Think about which trivial baseline and which simple, explainable model give you reference numbers before you try anything more flexible. ``` #### What This Part Should Cover - A split strategy that matches how the data was generated - Preprocessing that suits the chosen model, fitted without touching the test data - A baseline, a simple model and possibly a more flexible one, compared fairly ### Part 3 — Evaluate and explain Evaluate the model and explain what drives its predictions. ```hint Beyond accuracy Ask what accuracy a model that always predicts "no click" would get. ``` #### What This Part Should Cover - Metrics suited to the label balance, and how a decision threshold would be chosen - Whether the predicted probabilities are trustworthy - Which features matter and in which direction, and the next steps ### What a Strong Answer Covers - Fluent, narrated exploration with numpy or pandas, without stalling on syntax - Correct train and test discipline: stratification, grouping by user when users repeat, nothing fitted on test data - Sensible handling of skewed, nonnegative features with many zeros - A baseline, a logistic regression and a tree ensemble compared with cross-validation - Appropriate metrics (ROC AUC, PR AUC, log loss, calibration) and threshold reasoning - A clear interpretation and concrete next steps, such as features relating the user's time to the post's topic ### Follow-up Questions - The click rate turns out to be 2%. What changes in how you train and evaluate? - Logistic regression and gradient boosting reach the same AUC. Which would you ship, and why? - How would you use the post's topic so that the model learns a user's affinity for that particular topic? - The model's predicted probabilities average 0.30 while the observed click rate is 0.10. What happened, and how do you fix it?

Overview: A live notebook exercise: explore a dataset whose three features are a user's time spent on three Reddit topics, then train a binary classifier predicting whether the user clicks a post. It tests numpy and pandas exploration, scikit-learn pipelines, validation discipline, metric choice and model interpretation.

Reddit logo
Reddit
Oct 29, 2026
mediumMachine Learning EngineerTechnical ScreenMachine Learning
1
0

In a live coding screen you receive a link to a notebook and share your full screen while you work. The notebook poses a binary classification problem: predict whether a user will click a given Reddit post. The dataset has three features, each the time the user has spent on one of three Reddit topics, and a label saying whether the user clicked. Explore the data with numpy (pandas is fine too), then train and evaluate a binary classifier with scikit-learn, explaining your choices as you go.

Clarifying Questions Guidance

  • How many rows are there, and how imbalanced is the label?
  • What are the units of the time features (seconds, minutes), and over what period were they measured?
  • Does each row describe one user and one post? Is the post's own topic, or any post or user identifier, available, or is every row about the same post?
  • Can one user appear in many rows?
  • Which metric matters most to you: accuracy, ROC AUC, or something tied to how the predictions would be used?
  • Which libraries may I use, and may I look up documentation?

Part 1 — Explore the data

Inspect the dataset before modeling and report what you find.

What This Part Should Cover Guidance

  • Shape, types, missing values, duplicates and impossible values
  • The label's base rate
  • Each feature's distribution (skew, zeros, outliers) and its relationship with the click rate

Part 2 — Train a classifier

Split the data and train at least one classifier with scikit-learn.

What This Part Should Cover Guidance

  • A split strategy that matches how the data was generated
  • Preprocessing that suits the chosen model, fitted without touching the test data
  • A baseline, a simple model and possibly a more flexible one, compared fairly

Part 3 — Evaluate and explain

Evaluate the model and explain what drives its predictions.

What This Part Should Cover Guidance

  • Metrics suited to the label balance, and how a decision threshold would be chosen
  • Whether the predicted probabilities are trustworthy
  • Which features matter and in which direction, and the next steps

What a Strong Answer Covers Guidance

  • Fluent, narrated exploration with numpy or pandas, without stalling on syntax
  • Correct train and test discipline: stratification, grouping by user when users repeat, nothing fitted on test data
  • Sensible handling of skewed, nonnegative features with many zeros
  • A baseline, a logistic regression and a tree ensemble compared with cross-validation
  • Appropriate metrics (ROC AUC, PR AUC, log loss, calibration) and threshold reasoning
  • A clear interpretation and concrete next steps, such as features relating the user's time to the post's topic

Follow-up Questions Guidance

  • The click rate turns out to be 2%. What changes in how you train and evaluate?
  • Logistic regression and gradient boosting reach the same AUC. Which would you ship, and why?
  • How would you use the post's topic so that the model learns a user's affinity for that particular topic?
  • The model's predicted probabilities average 0.30 while the observed click rate is 0.10. What happened, and how do you fix it?