Skip to content

cjf-iii/media-sales-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📊 AI-Powered Media Sales Dashboard

Predict campaign performance. Optimize your media mix. Maximize ROAS.

Python Streamlit scikit-learn SciPy Plotly


An AI-powered tool that takes the guesswork out of media planning. Tell it your budget and goals — it tells you exactly where to spend and what to expect.


🎯 What This Does

In plain English: you give it a campaign budget, and it tells you the smartest way to split that money across six media channels to get the best return.

It does three things:

  1. Predicts performance — Enter your campaign details (industry, budget, audience, timing) and it forecasts impressions, CPM, click-through rate, conversions, and ROAS before you spend a dollar.

  2. Analyzes your portfolio — Upload past campaign data or explore the built-in dataset. See which campaigns crushed it and which underperformed, with interactive charts that make patterns obvious.

  3. Optimizes your media mix — Give it a total budget and any constraints ("at least 20% must go to Linear TV") and it mathematically finds the channel split that maximizes your return on ad spend.


🔥 The Problem It Solves

Media sales teams face the same question on every deal:

"We have $2M to spend across six channels. Where should the money go?"

Today, that answer usually comes from gut instinct, last quarter's plan, or a spreadsheet someone built three years ago. The result? Suboptimal allocation that leaves money on the table.

This dashboard replaces guesswork with machine learning. It trains on thousands of campaign outcomes to learn what actually drives performance — then uses constrained optimization to find the best possible media mix for any scenario.

The optimizer consistently finds allocations that deliver 49% better ROAS than splitting budget equally across channels.


⚙️ How It Works

flowchart LR
    A["📋 You Enter\nBudget + Goals"] --> B["🤖 ML Model\nPredicts KPIs"]
    B --> C["🔄 Optimizer\nTests Allocations"]
    C --> D["✅ Best Mix\nFound"]
    D --> E["💡 Recommendations\nChannel Shifts"]

    style A fill:#4A90D9,stroke:#2C5F8A,color:#fff
    style B fill:#7B68EE,stroke:#5A4CB5,color:#fff
    style C fill:#F5A623,stroke:#C4841A,color:#fff
    style D fill:#50C878,stroke:#3A9A5B,color:#fff
    style E fill:#FF6B6B,stroke:#CC5555,color:#fff
Loading

Step by step:

  1. You configure a campaign — Pick an industry, set a budget ($25K–$5M), choose your audience segment and market tier, then set channel allocation sliders for all six channels.

  2. The model predicts outcomes — A Random Forest model (trained on 3,000 campaign outcomes) predicts five KPIs simultaneously: impressions, CPM, CTR, conversion rate, and ROAS.

  3. The optimizer searches for the best split — Using constrained mathematical optimization (SLSQP), it tests thousands of possible channel allocations to find the one that maximizes predicted ROAS while respecting your constraints.

  4. You get specific recommendations — Not just "spend more on digital" — exact percentages and dollar amounts for each channel, with before/after comparisons showing the projected improvement.


📈 Key Metrics

Metric Value What It Means
Model Accuracy (R²) 0.85 The model explains 85% of the variance in ROAS — strong predictive power
ROAS Improvement +49% Optimized mix vs. equal allocation across channels
Channels Covered 6 Linear TV, Digital Video, Social, Podcast, DOOH, Programmatic Display
Industries 8 Auto, CPG, Finance, Healthcare, Retail, Tech, Telecom, Travel
Audience Segments 4 Adults 18-34, Adults 25-54, Adults 35-64, HHI $100K+
Market Tiers 4 Top 10 DMA, Top 25, Top 50, National
Predictions Per Campaign 5 Impressions, CPM, CTR, Conversion Rate, ROAS
Training Dataset 3,000 Synthetic campaigns with realistic performance correlations

✨ Features at a Glance

Tab 1: Campaign Planner

  • Configure any campaign scenario with interactive sliders
  • Real-time ML predictions update as you adjust channel mix
  • AI recommendation engine suggests specific channel reallocation moves
  • Metric cards show predicted impressions, CPM, CTR, conversions, and ROAS

Tab 2: Portfolio Analyzer

  • Upload your own campaign CSV or explore the built-in sample dataset
  • Budget vs. ROAS scatter plots, industry box plots, channel efficiency correlations
  • Top and bottom performer breakdowns
  • Interactive Plotly charts — hover, zoom, filter

Tab 3: Media Mix Optimizer

  • Set a fixed budget and optional per-channel minimum constraints
  • Optimizer finds the mathematically best channel allocation
  • Before/after comparison with delta metrics for every KPI
  • Clear dollar-amount recommendations for each channel

🏗️ Architecture

flowchart TB
    subgraph Data["Data Layer"]
        GEN["generate_data.py\n3,000 synthetic campaigns"]
        CSV[("campaigns.csv")]
        GEN --> CSV
    end

    subgraph Model["ML Layer"]
        TRAIN["train.py\nRandom Forest Pipeline"]
        JOBLIB[("model.joblib\n+ scaler + features")]
        CSV --> TRAIN
        TRAIN --> JOBLIB
    end

    subgraph App["Application Layer"]
        STREAMLIT["app.py — Streamlit Dashboard"]
        TAB1["Campaign Planner\nPredict KPIs"]
        TAB2["Portfolio Analyzer\nVisualize History"]
        TAB3["Media Mix Optimizer\nMaximize ROAS"]
        STREAMLIT --> TAB1
        STREAMLIT --> TAB2
        STREAMLIT --> TAB3
    end

    JOBLIB --> STREAMLIT
    CSV --> TAB2

    style Data fill:#E8F4FD,stroke:#4A90D9,color:#333
    style Model fill:#F0E8FD,stroke:#7B68EE,color:#333
    style App fill:#E8FDE8,stroke:#50C878,color:#333
Loading

📊 Sample Output: Before vs. After Optimization

Scenario: $1.5M Auto campaign targeting Adults 25-54 in Top 25 DMAs

Channel Equal Split Optimized Mix Change
Linear TV 16.7% ($250K) 28.0% ($420K) ▲ +11.3%
Digital Video 16.7% ($250K) 24.5% ($368K) ▲ +7.8%
Social 16.7% ($250K) 22.0% ($330K) ▲ +5.3%
Podcast 16.7% ($250K) 12.5% ($188K) ▼ -4.2%
DOOH 16.7% ($250K) 8.0% ($120K) ▼ -8.7%
Programmatic Display 16.7% ($250K) 5.0% ($75K) ▼ -11.7%
KPI Equal Split Optimized Improvement
ROAS 3.2x 4.8x +49%
Predicted Impressions 18.4M 22.1M +20%
Predicted CTR 1.8% 2.4% +33%

The optimizer shifts budget toward channels with the strongest predicted performance for this specific campaign profile — not a one-size-fits-all answer, but a tailored recommendation.


💼 Why This Matters for Sales Teams

For Account Executives: Walk into a pitch with data-backed media plans instead of recycled decks. Show clients exactly how their budget should be allocated and what performance to expect.

For Sales Managers: Benchmark your team's campaign recommendations against the optimizer. Identify which reps are consistently over-allocating to underperforming channels.

For VPs of Sales: Make strategic channel investment decisions grounded in predictive analytics. Know which verticals and audience segments have the highest ROAS potential before setting quotas.

For Revenue Operations: Automate the "what should we recommend?" question. Instead of hours in spreadsheets, get optimized media plans in seconds.


🚀 Quick Start

# One-command setup: creates venv, installs deps, generates data, trains model, launches app
chmod +x run.sh && ./run.sh

Or step by step:

python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python data/generate_data.py      # Generate 3,000 synthetic campaigns
python model/train.py             # Train Random Forest model
streamlit run app.py              # Launch dashboard at localhost:8501

🗂️ Project Structure

media-sales-dashboard/
├── app.py                        # Streamlit application (3 tabs)
├── data/
│   ├── generate_data.py          # Synthetic campaign data generator (~3,000 records)
│   ├── campaigns.csv             # Generated dataset
│   └── __init__.py
├── model/
│   ├── train.py                  # Random Forest training pipeline
│   ├── model.joblib              # Trained model artifact
│   ├── scaler.joblib             # Fitted StandardScaler
│   ├── feature_columns.json      # Feature column order for prediction
│   └── __init__.py
├── requirements.txt
├── run.sh                        # One-command setup & launch script
└── README.md

🛠️ Tech Stack

Component Technology Purpose
Frontend Streamlit Interactive dashboard UI
Visualization Plotly Interactive charts and graphs
ML Model scikit-learn (Random Forest) Multi-target KPI prediction
Optimization SciPy (SLSQP) Constrained media mix optimization
Data Processing pandas, NumPy Feature engineering and data manipulation

👤 About the Author

CJ Fleming — Media sales leader with 15+ years of experience across linear TV, digital video, and emerging platforms. Columbia University AI certification. This project demonstrates the intersection of deep media sales domain expertise and applied machine learning.

This isn't a theoretical exercise — it's the tool I wish I'd had during a decade and a half of building media plans, negotiating upfronts, and optimizing cross-platform campaigns.

LinkedIn GitHub Email

About

AI-powered campaign performance predictor + media mix optimizer with Random Forest and SciPy — Streamlit dashboard

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors