RetainX: Smart Demand Signals

Inspiration

With a portfolio of over 6,000 dental clinics and highly variable purchasing patterns, B2B sales teams often find themselves reacting to lost clients rather than proactively securing them. Our inspiration came from the Inibsa "Smart Demand Signals" challenge: the goal of transforming raw, complex historical sales data into a proactive radar. We wanted to build a tool that doesn't just show a dashboard of past sales, but actually acts as a "co-pilot" for commercial reps—identifying hidden demand and preventing churn before the client leaves.

What it does

RetainX is a predictive commercial alert system that anticipates client behavior. It analyzes purchasing patterns while making a crucial distinction between "Commodities" (regular, recurring consumption) and "Technical Products" (variable, case-dependent consumption).

It segments clients into four actionable states: Loyal, Promiscuous, Risky, and Promising, based on their sales trends and the percentage of their purchasing potential we've captured. But instead of just showing their current state, RetainX predicts their future state 4 weeks out. If the system detects a negative transition (e.g., a Loyal client dropping to Risky) or a missed opportunity (a Promiscuous client showing high potential to grow), it generates a highly prioritized, explainable alert for the sales team detailing exactly which product is causing the drop.

How we built it

We built a robust, end-to-end data pipeline and wrapped it in a user-friendly web interface:

  • Data Processing: We loaded 5 years of historical Excel data (Sales, Products, Clients, Potential, Campaigns) and aggregated it into weekly time-series data to smooth out the noise of daily transactions.
  • Hierarchical Forecasting: We used SARIMA to forecast high-level product-type demand (Commodities vs. Technical). We then used SARIMAX to forecast individual product demand, using the high-level block forecast as an external factor to increase accuracy.
  • Clustering & Classification: We calculated the slope of purchasing trends and the "capture ratio" (sales vs. potential). Using a combination of threshold logic and Gaussian Mixture Models (GMM), we mapped clients into our four states.
  • The Transition Engine: The system compares the current_state with the forecasted future_state using a transition matrix.
  • User Interface: We built a web application where users can upload datasets, tweak the default feature parameters, and instantly view prioritized alerts (Risk with high potential, Risk with low potential, etc.) and positive transitions.

Challenges we ran into

  • The "Silence" Problem: One of the biggest challenges in B2B sales is that a lack of purchase doesn't always mean churn. We had to carefully tune the models to ensure we didn't confuse a normal pause in Technical Product purchases with actual client abandonment in Commodities.
  • Noisy Data: Daily sales data was incredibly sparse. Shifting to a weekly aggregation (week_start) was critical to getting the SARIMA models to converge and produce meaningful forecasts.
  • Explainability: A black-box AI is useless to a sales rep. We had to engineer the pipeline so that every alert points back to the "driver product" (the specific SKU or category causing the alert) so the rep knows exactly what to mention on the phone.

Accomplishments that we're proud of

  • The Hierarchical Model: Successfully linking SARIMA macro-trends to SARIMAX micro-trends gave us a highly nuanced prediction model that respects the product hierarchy.
  • Actionable AI: We didn't just build a forecasting model; we built a business logic layer on top of it. Translating complex slopes and capture ratios into simple, prioritized alerts (like "Urgent: Loyal to Risky transition detected on Anesthesia") is something that provides immediate commercial value.
  • Working Web Interface: Taking it from a messy Python notebook to a clean web UI where users can toggle features and see prioritized lists of who to call today.

What we learned

  • Context is King: In time-series forecasting for sales, mathematical accuracy isn't enough. You have to encode business context (like the difference between a recurring commodity and a one-off technical purchase) into the model for the outputs to make sense.
  • The Value of Prioritization: Sales teams have limited time. An alert system is only as good as its ability to rank issues. Prioritizing a "Risky client with high potential" over a "Risky client with low potential" is vital for ROI.

What's next for RetainX

  • Machine Learning Feedback Loop: We want to add a feature where sales reps can flag an alert as a "False Positive" or "Successful Recovery" to continuously retrain and improve the model over time.
  • CRM Integration: Taking the alerts out of our standalone web app and pushing them directly into the CRM systems that reps already use daily.
  • Campaign Impact Analysis: Deeper integration of promotional campaign data to predict how specific marketing actions might alter a client's future state trajectory.

Built With

Share this project:

Updates