Predict high-risk product returns before they happen using Machine Learning and Ensemble Learning.
Product returns are a major challenge for e-commerce companies, leading to:
- Increased logistics costs
- Refund processing expenses
- Inventory management issues
- Reduced operational efficiency
This project uses Machine Learning to predict the probability of a customer returning a purchased product based on customer behavior, product characteristics, pricing information, and transaction history.
The system enables retailers to proactively identify high-risk orders and take preventive actions such as targeted customer support, product recommendations, or fraud investigation.
https://hcl-hackathon-retailreturnclassification.streamlit.app/
✅ End-to-End Machine Learning Pipeline
✅ Ensemble Stacking Architecture
✅ Advanced Feature Engineering
✅ Probability-Based Risk Scoring
✅ Interactive Streamlit Web Application
✅ Production-Ready Model Serialization
✅ Real-Time Predictions
Returns cost online retailers billions of dollars annually.
Most companies react after a return occurs.
This system shifts the process from:
Reactive Returns Management → Predictive Returns Prevention
By identifying return-prone purchases beforehand, businesses can:
- Reduce return-related losses
- Improve customer satisfaction
- Optimize logistics operations
- Improve inventory planning
User Input
│
▼
Streamlit Web App
│
▼
Feature Engineering Layer
│
▼
Stacked Ensemble Model
│
▼
Return Probability Prediction
│
▼
Business Decision Support
- Age
- Gender
- Income Bracket
- Loyalty Program
- Membership Duration
- Customer Support Calls
- Days Since Last Purchase
- Category
- Subcategory
- Brand
- Price
- Discount
- Product Rating
- Review Count
- Historical Product Return Rate
- Quantity
- Total Items Purchased
- Season
- Weekend Indicator
- Holiday Season Indicator
- Numerical Features → Median Imputation
- Categorical Features → Most Frequent / Unknown
- One-Hot Encoding
- Boolean Standardization
- Duplicate Removal
- Category Standardization
- Outlier Validation
- Numerical Feature Normalization
Several domain-specific features were created to improve predictive performance:
final_price = price - discount
discount_ratio = discount / priceis_loyal = 1 if loyalty_program == "Yes"value_per_item = final_price / quantityThese engineered features improved the model's ability to capture purchasing patterns associated with returns.
- Captures global linear relationships
- Interpretable baseline model
- Handles non-linear interactions
- Robust against overfitting
- Captures complex decision boundaries
- Strong performance on tabular datasets
The final prediction is generated using a Stacking Ensemble Architecture.
Logistic Regression
│
▼
Random Forest
│
▼
XGBoost
│
▼
Meta Logistic Regression
│
▼
Final Prediction
The meta-model learns the optimal combination of predictions from all base learners, resulting in better performance than individual models.
Evaluation metrics used:
- Accuracy
- Precision
- Recall
- F1 Score
- ROC-AUC
- Confusion Matrix
In return prediction systems, missing an actual return is often more costly than a false alarm.
Therefore, Recall was treated as a primary optimization metric.
The application provides a simple interface where users can enter:
- Customer Age
- Product Price
- Discount
- Product Return Rate
- Quantity
- Loyalty Program Status
The system then predicts:
Prediction: Returned / Not Returned
Return Probability: 84%
⚠️ High Return Risk- ✅ Low Return Risk
- Python
- Scikit-Learn
- XGBoost
- Pandas
- NumPy
- Streamlit
- Joblib
git clone https://github.com/yourusername/customer-return-prediction.git
cd customer-return-predictionpip install -r requirements.txtstreamlit run app.py- SHAP Value Analysis
- Feature Importance Dashboard
- Docker Containerization
- CI/CD Pipeline
- Automated Retraining
- FastAPI Backend
- AWS/GCP Deployment
- Real-Time Prediction API
- Data Drift Detection
- Model Performance Tracking
- Prediction Monitoring Dashboard
Developed as part of an ML Hackathon challenge focused on solving real-world retail analytics problems using machine learning and predictive modeling.
Siddhi Jadhav
Aspiring Data Scientist | Machine Learning Engineer
- LinkedIn: Siddhi Jadhav
- GitHub: Siddhi-Jadhav01