Inspiration

Every year, consumer packaged goods (CPG) companies face a silent profit killer: customer churn. For a giant like Arca Continental, identifying exactly when a mom-and-pop shop or a local distributor is about to stop buying is a massive challenge hidden within millions of rows of monthly transaction logs. We wanted to build more than just a cold mathematical model trapped in a Jupyter Notebook. We were inspired to create a complete, end-to-end intelligent ecosystem that turns complex predictive data into immediate, conversational, and personalized retention strategies for sales teams on the ground.

What it does

Churn Hunters is an AI-powered customer retention ecosystem. It ingests historical transaction data, cold-chain infrastructure details (coolers), and demographic variables to predict the precise probability of a client leaving. The platform is split into two core experiences within an interactive web application:

  1. Interactive Analytics Dashboard: Allows regional managers to segment and visualize churn risks dynamically by territory and business size.
  2. CHESCO (AI Retail Consultant): A customized generative AI agent acting as a strategic consultant. Users can talk to Chesco in natural language to query a specific client's risk and instantly receive tailored, actionable marketing and sales playbook recommendations to save that account.

How we built it

We built a fully automated pipeline structured into modular layers:

  • The Data Core: We processed 5 distinct data sources (clientes, coolers, transaction logs, etc.), enforcing strict business cleaning rules to eliminate negative transaction noise while preserving crucial churn signals.
  • The Predictive Brain: We implemented a CatBoost Classifier optimized via the PR-AUC (Precision-Recall Area Under Curve) metric to handle severe class imbalance effectively. CatBoost natively managed our rich categorical features (like commercial subchannels) without losing interpretability.
  • The Orchestrator (Modelo_Churn.py): A single-click python script that runs the entire pipeline—from raw data extraction and feature engineering to model inference and normalization—outputting a single unified Master Dataset.
  • The Interface & Generative layer: We deployed a fast, reactive frontend using Streamlit and integrated a specialized Gemini Core API model to act as our conversational assistant, "Chesco," feeding it the contextual business rules of the challenge.

Challenges we ran into

  • Class Imbalance: Only 17.9% of the dataset represented churned clients. Relying on traditional Accuracy metrics would have created a lazy model that ignored the minority class. We overcame this by shifting our training target to PR-AUC and utilizing stratified cross-validation.
  • Visual Text Overlap: In our early exploratory dashboards, rendering vertical charts for variables with dozens of features (like geographic states) made the UI unreadable. We completely restructured our plotting framework to leverage uniform horizontal charts (barh) linked to a single, strict churn-rate sorted index.
  • Data Integration Friction: Merging machine learning outputs back with raw, untreated business data for presentation can heavily slow down an app. We solved this by creating a backend Master Generator script to seamlessly handle all concatenations before the application layer ever boots up.

Accomplishments that we're proud of

  • End-to-End Automation: Consolidating a complex multi-step data science process into a single, bulletproof script (Modelo_Churn.py) that outputs a production-ready dataset.
  • Actionable Generative AI: Turning raw decimal probabilities into conversational, tactical retail advice. Chesco doesn't just say "Client X has an 82% churn risk"—it suggests "Client X dropped transactions but has 3 empty coolers; offer a volume promotion immediately."
  • Robust Metric Design: Building an architecture tailored to real business costs where missing a churning client is far more expensive than a false alarm.

What we learned

  • The Power of Symmetrical Trees: CatBoost proved to be remarkably fast and robust out-of-the-box compared to traditional heavy encoding techniques.
  • Data Context over Code: A model is only as good as its business logic. Deeply understanding how Arca Continental tracks its inventory and client tiers allowed us to engineer far better features than random mathematical tweaking would have.
  • UI/UX Matters in Data Science: Insights are useless if decision-makers find them hard to read. Prioritizing scannability and conversational AI makes advanced data science genuinely accessible to non-technical teams.

What's next for Churn Hunters

  • Real-time Streaming Ingestion: Upgrading the pipeline from monthly batch processing to real-time transactional event streaming to catch churn signals weeks earlier.
  • Prescriptive Financial Forecasting: Integrating revenue metrics so Chesco can prioritize the sales queue not just by the probability of the churn, but by the financial impact that specific client represents to the company's bottom line.
  • Geo-Spatial Risk Maps: Adding interactive maps to visualize regional churn clusters and optimize geographic distribution paths.

Built With

Share this project:

Updates