MediumBeyond Simple Forecasting: A Multi-Engine Machine Learning Architecture for Enterprise Resource Planning | by Abhirami Kumaraguruparan | Medium
Sitemap

Beyond Simple Forecasting: A Multi-Engine Machine Learning Architecture for Enterprise Resource Planning

6 min readJun 9, 2026

--

In enterprise retail operations, predicting top-line revenue is only half the battle. A sales forecast locked in a vacuum cannot tell an inventory manager how many stock units to order, nor can it tell a marketing lead how to plan promotional buffers.

Get Abhirami Kumaraguruparan’s stories in your inbox

Join Medium for free to get updates from this writer.

To bridge the gap between machine learning metrics and downstream business execution, I designed and deployed a dual-engine predictive pipeline utilizing XGBoost Regressors. By predicting both gross revenue (Sales) and transaction volume (#Order) simultaneously across a dataset of over 180,000 records, this framework translates raw predictions into actionable, real-world strategies on the store floor.

1. Introduction: The Business Case

  • The Problem: Traditional demand models often focus entirely on forecasting sales value. However, high-stakes operational choices require a deeper understanding of transaction density. For example, a store generating $50,000 in sales from 2,000 low-ticket items requires an entirely different layout, stocking, and staffing setup than a store generating the same $50,000 from 200 luxury-tier transactions.
  • To tackle this complexity, this framework processes multi-dimensional input vectors to feed two distinct, specialized gradient-boosting engines. The synchronized outputs allow enterprise leadership to move from passive estimation to active resource optimization.
  • Keywords: Demand Forecasting, Supply Chain Optimization, Inventory Management, Multi-Target Machine Learning, MLOps.

2. Exploratory Data Analysis (EDA): Finding the “Signal”

  • Seasonality & Trends: Visualizing historical sales volume over continuous time horizons revealed clear cyclical patterns. The data demonstrated that temporal variations — specifically macroeconomic “Holidays” — and categorical classification like “Store Type” act as the strongest foundational predictors for sales fluctuations.
Press enter or click to view image in full size
  • Hypothesis Testing: To validate these observations mathematically rather than relying solely on a baseline correlation matrix, explicit statistical testing was conducted:
  • T-Tests: Run to analyze promotional impact. “We confirmed with 95% confidence ($p < 0.05$) that promotional discounts significantly shift the sales baseline for S1-type stores.”
  • ANOVA: Executed across store types, proving that variance between different store profiles is statistically significant, requiring models capable of processing distinct feature combinations.
  • Outlier Treatment: The raw distribution exhibited a heavy positive skew due to extreme sales anomalies (e.g., store grand openings). To guarantee model stability without losing critical peak trading patterns, extreme values were addressed by capping the target variable at the 99th percentile.
Press enter or click to view image in full size

3. Feature Engineering: Crafting Information

Raw transactional elements were systematically processed into structured numerical arrays. To fully capture geographic and consumer behavioral variations, the dataset was mapped across three primary contextual axes:

  • Geographic Segmentation (Region_Code): Isolates macroeconomic regional boundaries to handle distinct consumer ecosystems and localized supply chains.
  • Temporal Deconstruction (Month, DayOfWeek): Converts standard date strings into human-readable calendars. This ensures the model treats customer volume accurately across different months, days of the week, and weekend variations.
  • Operational Parameters (Store_Type, Location_Type, Discount, Holiday): Captures high-cardinality nominal values (e.g., Mall Kiosks vs. Supercenters) and matches them with active promotional markdowns or statutory holiday matrices.

4. The Model Showdown

Rather than leaking future operational metrics by using #Order as an input feature, the architecture splits the task into a dual-engine execution sequence.

Press enter or click to view image in full size

Both models utilize sequential decision trees to minimize global error gradients. By processing the exact same feature space independently, the system produces a highly precise, synchronized output: Gross Revenue, Order Footfall, and Average Order Value (AOV) (AOV = Sales/ Orders).

5. Deployment: Turning Code into a Product

To turn these models into an accessible product for store managers and financial analysts, I wrapped the entire dual-engine pipeline inside an interactive full-stack Flask web application.

  • The Frontend Engine: Built with Bootstrap 5 and enhanced with intuitive icon geographies via Bootstrap Icons. The user input panel replaces confusing numerical codes with clean, human-readable dropdown options (e.g., “Region R1”, “Active Markdown Events”, “Saturday”, “January”).
  • State Persistence: The form logic utilizes secure Jinja2 conditional tokens. This ensures that when a user triggers a forecast, the page updates without erasing their selected parameters.
  • Visual Cards System: The outputs are separated into a clear visual hierarchy. Primary algorithmic metrics sit at the top of the interface in colored highlight cards, immediately followed by the specific action plans for the core inventory, financial, and promotional pillars.
Press enter or click to view image in full size
  • The Tableau Dashboard: Show a high-quality screenshot of your Tableau dashboard (with the card-style layout and curved edges we discussed). Explain that this provides the Strategic Overview, while the Flask app provides Operational Forecasts.
Press enter or click to view image in full size

6. How the Predictions Help the Business:

When a user picks a store, region, and date on the interface, the system calculates the predicted Sales and Orders. Instead of just showing raw numbers, it instantly turns that data into clear, practical action plans across three core areas of retail operations:

1. Inventory Management (Smart Stocking)

The system uses the predicted order numbers to tell store managers exactly how much product to keep on the shelves. It automatically adds a 15% extra safety cushion to the order estimate ($\text{Orders} \times 1.15$). This ensures the store has enough items to meet customer demand without overstocking, which saves money on warehouse space and prevents perishable goods from spoiling.

2. Financial Planning (Budgeting & Staffing)

The app takes the predicted total sales revenue and automatically subtracts 10% for basic running costs. This gives the finance team a realistic look at the actual net revenue they will bring in. If the model predicts a massive sales day, the system flags it and recommends setting aside a larger budget to hire extra temporary staff for that shift to handle the rush.

3. Marketing and Promotions (Checking Deal Success)

By looking at the Average Order Value (how much the average customer spends per visit) alongside active discounts, the dashboard shows if a promotional campaign is actually working.

  • High average spend means customers are genuinely engaged and buying premium items alongside the deals.
  • Low average spend means the store is just moving a lot of cheap, heavily discounted items with very low profit margins, signaling a need to alter the promotional layout.

6. Conclusion & Learnings

  • Predicting Two Things is Better Than One: Forecasting sales and orders at the same time lets us calculate crucial business metrics (like average customer spend) that a single sales forecast cannot show.
  • Keeping the Math Honest: Treating order volume as something the model needs to predict — instead of an input feature we already know — keeps the data realistic and prevents fake accuracy spikes.
  • Building for Real People: Complex code delivers the most value when turned into a clean, simple web tool that regular store managers and finance teams can use instantly.
  • Explore the Project Work: You can checkout the full backend code and machine learning scripts on my https://github.com/Abhirami-Kumaragurupanan/SalesForecaseting.git or explore the interactive sales trend charts on my Product_Sales_Forecast | Tableau Public.

--

--