Analyzed a ~$2.3M retail dataset (~10K orders) to identify profit leakage drivers and evaluate how discount optimization can improve margins using machine learning and simulation.
Despite generating strong revenue, the business is experiencing margin leakage across several product segments. High-volume categories are failing to translate sales into profit due to excessive discounting and inefficient pricing strategies.
The key challenge is to optimize discounting without negatively impacting sales performance.
This project aims to identify the drivers of profitability and quantify the impact of targeted pricing interventions using transaction-level data and machine learning.
Analyzed category and sub-category level performance to identify where margin erosion was concentrated.
Key findings:
- Furniture generated high sales but the lowest profit margins
- Tables, Bookcases, and Supplies were consistently loss-making
- Discounts above ~20–25% strongly correlated with negative profitability
- Copiers emerged as a high-profit sub-category despite lower volume
To understand the drivers of profitability, I built two models:
- Linear Regression
- Decision Tree Regressor
The goal was to predict profit using:
- Discount
- Quantity
- Category
- Sub-Category
| Model | R² | RMSE |
|---|---|---|
| Linear Regression | 0.073 | 211.96 |
| Decision Tree | 0.141 | 204.12 |
The decision tree outperformed linear regression, suggesting that profitability is influenced by nonlinear interactions between discounting, product mix and sales volume. The relatively low R² indicates that profitability is influenced by multiple interacting factors, reinforcing the need for non-linear modeling approaches.
Using the trained decision tree model, a pricing intervention was simulated by capping discounts at 20%.
- Projected profit uplift: +$182K
This highlights the significant margin improvement potential from reducing excessive discounting.
Based on the analysis and simulation results, the following actions are recommended:
Capping discounts at 20% can significantly improve profitability, particularly in high-impact sub-categories such as Binders, Machines, and Tables.
A uniform discounting approach leads to margin erosion. Pricing strategies should be tailored at the sub-category level, with stricter controls on low-margin products.
Establish ongoing monitoring to identify when discounting negatively impacts margins and enable timely corrective actions.
A small number of sub-categories drive the majority of profit uplift. Focusing on these areas will deliver faster and more meaningful results.
Before full-scale implementation, pricing changes should be tested through controlled experiments (A/B testing) to ensure minimal impact on sales volume.
- Profitability is driven by discounting, product mix, and sales volume
- High sales do not necessarily translate into high profit
- Discount optimization should be targeted, not uniform
- A small number of sub-categories drive most of the potential gains
- Binders: +$81.9K
- Machines: +$29.5K
- Tables: +$21.2K
- Chairs: +$12.7K
- Furnishings: +$10.8K
This indicates that even seemingly stable categories may be over-discounted and hiding margin potential.
Shows the relationship between increasing discount levels and declining profitability.

Highlights which product groups generate profit and which contribute to losses.

Shows where the simulated pricing intervention generated the most value.

Illustrates how profit distribution worsens as discount levels increase.

- Python
- Pandas
- NumPy
- Scikit-learn
- Matplotlib
- Seaborn
- Google Colab
pricing_analysis.ipynb— full notebook with EDA, modeling, simulation, and visualizationsSample - Superstore.csv— dataset used for analysisoutputs/charts/— saved visualization outputs
This project demonstrates how analytics and machine learning can support pricing strategy by:
- identifying hidden profit leakage
- quantifying the impact of discounting
- simulating pricing interventions
- enabling data-driven commercial decisions
To operationalize this analysis, the following steps can be taken:
The model can be embedded into existing pricing workflows (e.g., CRM, ERP, or pricing tools) to flag transactions where discounts exceed recommended thresholds. This enables sales teams to make more informed pricing decisions in real time.
Develop dashboards to track key metrics such as:
- average discount by product segment
- profit margin trends
- impact of discount changes over time
This allows business teams to continuously monitor the relationship between discounting and profitability.
Translate insights into clear business rules, such as:
- maximum discount thresholds by sub-category
- approval workflows for high-discount transactions
- recommended discount ranges based on product margin
This ensures consistency in pricing decisions across teams.
Before full rollout, implement A/B testing or pilot programs:
- apply discount caps to a subset of products or regions
- compare sales and profit outcomes against control groups
This validates the impact and reduces implementation risk.
Provide training and clear communication to sales teams:
- explain the impact of discounting on profitability
- align incentives with margin improvement, not just revenue
Adoption is critical, even the best models fail without behavioral change.
By embedding data-driven pricing into daily operations, the business can move from reactive discounting to a more disciplined and optimized pricing strategy.
This enables sustained margin improvement, better decision-making, and scalable pricing optimization over time.
Potential next steps for this analysis:
- test additional models such as Random Forest or XGBoost
- incorporate revenue and margin ratio features
- simulate category-specific discount thresholds instead of a single cap
- validate findings with controlled pricing experiments