Skip to content

Latest commit

ย 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Predicting User Ad Clicks Using Machine Learning ๐Ÿ“Š๐Ÿง 

Author: Swapnil Herwadkar

Tech Stack: Python, Scikit-Learn, XGBoost, SMOTE, Pandas, Matplotlib

๐Ÿ” Overview This project presents a machine learning pipeline for predicting whether a user will click on an online ad, based on behavioral and demographic data. By applying robust preprocessing, handling class imbalance with SMOTE, and optimizing models like XGBoost, this project aims to improve digital ad targeting and maximize click-through rates.

๐ŸŽฏ Objectives Predict ad click-through behavior using user features and ad context.

Handle severe class imbalance to better identify the minority (clicked) class.

Engineer interaction features to enhance model performance.

Evaluate and compare model performance using classification metrics.

๐Ÿ› ๏ธ Methods & Techniques

  1. ๐Ÿงน Data Preprocessing Dropped irrelevant features (e.g., ID, full name).

One-hot encoding for categorical variables (e.g., device type, ad position).

Created interaction terms to capture contextual behavior (e.g., device_type ร— time_of_day).

  1. โš–๏ธ Class Imbalance Handling Applied SMOTE (Synthetic Minority Over-sampling Technique) to balance the dataset and improve recall for rare events (ad clicks).

  2. ๐Ÿค– Models Used Logistic Regression (baseline)

Random Forest (ensemble model)

XGBoost (best performer after hyperparameter tuning)

  1. ๐ŸŽฏ Evaluation Metrics Accuracy, Precision, Recall

Confusion Matrix

ROC-AUC Curve

๐Ÿ“ˆ Key Results XGBoost achieved the highest performance post-SMOTE and hyperparameter tuning.

Visualization of class balance before/after SMOTE showed significant improvements in model learning.

Feature interactions (e.g., ad_position ร— browsing_history) played a key role in performance gains.

๐Ÿ“Œ Visualizations Bar plots for performance metrics

Confusion matrices per model

ROC curves comparing classifiers

Class distribution before and after SMOTE

๐Ÿ’ก Insights & Recommendations Time of Day, Device Type, and Ad Position are highly predictive features.

SMOTE was critical in overcoming class imbalance and improving minority class recall.

This framework can be deployed in real-time ad platforms to dynamically adjust ad placement and content.

๐Ÿš€ Future Improvements Incorporate time zone and session-based behavior.

Deploy as a REST API for real-time predictions.

Experiment with deep learning models for higher granularity.

About

Machine learning project predicting ad clicks with Logistic Regression, Random Forest, XGBoost, SMOTE, and behavioral feature engineering.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors