This project uses machine learning to predict a customer's next product based on their previous purchase behavior. Using the Online Retail dataset, customer transactions are transformed into sequential purchase patterns and used to train a classification model for next-product prediction.
The model takes a customer's previous and current products as input and predicts the next product in their purchase sequence.
Input: Previous product + Current product
Output: Predicted next product
This project predicts the next product a customer is likely to purchase based on their previous behavior.
- Online Retail Dataset
- Contains real-world transaction data of customers
- Cleaned the Online Retail transaction data by handling missing values and returns.
- Sorted customer transactions chronologically to preserve purchase behavior.
- Created individual purchase sequences for each customer.
- Converted sequences into previous-product → current-product → next-product patterns.
- Encoded product identifiers into numerical features for machine learning.
- Trained a Random Forest Classifier to predict the next product.
- Evaluated the model's prediction performance on unseen data.
Random Forest Classifier
- Input: Previous product + current product
- Target: Next product in the customer's purchase sequence
- Task: Multi-class classification
- Output: Predicted next product
- Python
- Pandas
- Scikit-learn
- Random Forest
- Machine Learning
- Data Preprocessing
- Feature Engineering
- Accuracy: ~21%
- Task: Multi-class next-product prediction
- The problem involves predicting among a large number of possible products, making next-product prediction challenging.
This project demonstrates how customer purchase histories can be transformed into sequential data for next-product prediction. It provides a foundation for building more advanced recommendation systems using richer behavioral features and sequence-based machine learning models.