Introduction to click-through rates

Predicting CTR with Machine Learning in Python

Kevin Huo

Instructor

Click-through rates

  • Click-through rate: # of clicks on ads / # of views of ads
  • Companies and marketers serving ads want to maximize click-through rate
  • Prediction of click-through rates is critical for companies and marketers

Example of ad from Facebook

Predicting CTR with Machine Learning in Python

A classification lens

  • Classification: assigning categories to observations
  • Classifiers use training data and are evaluated on testing data
  • Target: a binary variable, 0/1 for non-click or click
  • Feature: any variable used to help predict the target

Classification example with red and blue

Predicting CTR with Machine Learning in Python

A brief look sample data

Sample rows from ad click dataset

  • Each row represents a particular outcome of click or not click for a given user for a given ad
  • Filtering for columns can be done through .isin(): df.columns.isin(['device'])]
  • Assuming y is a column of clicks, CTR can be found by: y.sum()/len(y)
Predicting CTR with Machine Learning in Python

Analyzing features

print(df.device_type.value_counts())
1    45902
0    2947
print(df.groupby('device_type')['click'].sum())
0     633
1    7890
Predicting CTR with Machine Learning in Python

Let's practice!

Predicting CTR with Machine Learning in Python

Preparing Video For Download...