An e-commerce company wants to predict whether a visitor will make a purchase based on their browsing session behavior. The goal is to build a Machine Learning model that can classify sessions into purchase (Revenue = True) or no purchase (Revenue = False).
- ~12,330 user sessions
- Mix of numerical and categorical features
- Target variable: Revenue
- Python
- Pandas, NumPy
- Matplotlib, Seaborn
- Scikit-learn
- Checked data distribution
- Identified class imbalance
- Visualized key features
- Handled categorical variables
- Feature transformations
- Prepared dataset for model training
- Decision Tree Classifier
- Applied pruning to avoid overfitting
- Handled class imbalance using class weights
- Hyperparameter tuning using GridSearchCV
- Metric used: F1 Score (due to imbalanced dataset)
-
Algorithm: Decision Tree Classifier
-
Techniques used:
- Pruning (
max_depth,min_samples_split) - Class balancing
- Hyperparameter tuning (GridSearchCV)
- Pruning (
- Achieved F1 Score: ~0.55+ (target met)
ECOMMERCE-PURCHASE-PREDICTION/
│
├── data/
│ └── raw/
│ └── shop_smart_ecommerce.csv # Original dataset
│
├── models/
│ └── best_model.pkl # Saved trained model
│
├── notebooks/
│ └── Ecommerce_P...ipynb # Main notebook (EDA + training)
│
├── src/
│ ├── evaluate.py # Model evaluation (F1, metrics)
│ ├── preprocess.py # Data preprocessing
│ ├── train.py # Model training
│ └── utils.py # Helper functions
│
├── .gitignore
├── main.py # Entry point script
├── README.md
├── requirements.txtgit clone https://github.com/your-username/ecommerce-purchase-prediction.git
cd ecommerce-purchase-predictionpip install -r requirements.txtpython main.pyAbhay Singh