A production-quality, single-file ML model governance and explainability dashboard built with Plotly.js. This portfolio project demonstrates advanced skills in ML model monitoring, interpretability, fairness testing, and business analytics.
This interactive dashboard provides comprehensive ML model governance tools for data analysts and ML engineers, covering:
- Model Performance Monitoring β Track accuracy, precision, recall, F1 across production deployments
- Explainability (XAI) β SHAP-style beeswarm plots, feature importance, partial dependence plots
- Data Drift Detection β Population Stability Index (PSI), KL divergence, distribution shifts
- Fairness & Bias Analysis β Demographic parity, equal opportunity, disparate impact metrics
- What-If Analysis β Interactive prediction explorer with local explanations
- Model Comparison β Side-by-side version analysis and radar charts
- Switch between 3 production models (Customer Churn, Loan Default, Demand Forecasting)
- Real-time drift status (green/amber/red indicators)
- Key metrics at a glance: Accuracy, F1, AUC, predictions served
- 6-month performance trends with Plotly multi-line charts
- Annotated events: model retraining, feature engineering, pipeline issues
- Visual highlighting of degradation zones
- Permutation Feature Importance β Bar chart showing feature contribution to predictions
- SHAP Beeswarm Plot β Scatter plot per feature showing:
- X-axis: SHAP value (impact on model output)
- Y-axis: Feature
- Color: Feature value (blue=low, red=high)
- Each dot = one prediction, revealing feature distribution impact
- Partial Dependence Plots (PDP) β How model output changes as one feature varies
- Individual Conditional Expectation (ICE) β Gray lines showing individual prediction trajectories
- Waterfall Charts β Feature-by-feature contribution breakdown for specific predictions
- Quantifies distribution shift between training and production data
- Thresholds: Green (<0.1), Amber (0.1-0.25), Red (>0.25)
- Time-series heatmap: PSI values across features and time periods
- Overlaid KDE histograms: Reference (training) vs. Current (production)
- KL Divergence implementation in JavaScript
- Interactive feature selector
- Histogram: Baseline vs. current prediction probability distributions
- Calibration Curve β Predicted probability vs. actual outcome rate
- Identifies model miscalibration in production
- Confusion Matrix β Interactive heatmap (TN, FP, FN, TP)
- ROC Curve β AUC metric, visual threshold sensitivity
- Precision-Recall Curve β Trade-off analysis
- Threshold Slider β Real-time metric updates (sensitivity, specificity, F1)
Metrics across demographic groups (Age, Gender, Region):
- Demographic Parity β Positive prediction rate by group
- Equal Opportunity β True Positive Rate (TPR) by group
- Disparate Impact Ratio β Legal threshold monitoring (0.8-1.25)
- Summary table with fairness metrics
Interactive form with sliders for all input features:
- Real-time Prediction Output β Current model score + confidence
- Sensitivity Analysis β How each feature change affects prediction
- Waterfall Chart β SHAP-style local explanations
- "Find Flip Point" β Suggests feature changes to alter prediction
- Side-by-side metrics: Accuracy, F1, AUC, Latency, Training Time, Model Size
- Radar Chart β Multi-metric spider diagram comparing versions
- Version history trend: accuracy & F1 across model releases
- Single HTML File β No build tools, npm, or external dependencies needed
- Plotly.js from CDN β All visualizations via Plotly
- Vanilla JavaScript β Pure JS algorithms, no framework dependencies
- Responsive Design β Mobile-friendly CSS Grid layout
- Dark Theme β Enterprise design with Tailwind-inspired colors
All implemented in vanilla JavaScript:
// PSI Calculation
function calculatePSI(referenceData, currentData, feature, bins = 10)
- Bins both distributions
- Calculates proportion ratio
- Returns sum of KL divergence
// Feature Permutation Importance
function calculateFeatureImportance(data, features)
- Shuffles each feature
- Measures impact on baseline accuracy
- Returns importance scores
// SHAP-style Values
function calculateSHAPValues(data, features, numSamples = 200)
- Feature contribution decomposition
- Normalized feature value encoding
- Returns per-sample SHAP values
// Logistic Regression (What-If)
- Coefficient-based prediction: z = w0 + Ξ£(wi * xi)
- Sigmoid transform: 1 / (1 + e^-z)
- Feature contributions via partial derivativesSeeded Random Generator β Reproducible synthetic data:
- 5,000 training samples per model
- 10 features: age, income, tenure, usage_frequency, support_tickets, etc.
- Gaussian distributions with realistic correlation structure
- Production data with 6 months of synthetic drift
- Fairness-relevant demographics with realistic distributions
Inspired by SHAP library's beeswarm plot:
- Each dot = one prediction
- X-axis = SHAP value (positive = increases churn prediction, negative = decreases)
- Y-axis = feature
- Color = feature value (blue=low, red=high)
- Reveals both magnitude and direction of feature impact
- Shows when feature importance varies by feature value
Shows average model behavior:
- X-axis = feature value range
- Y-axis = predicted probability
- Blue line = average effect (PDP)
- Gray lines = individual prediction trajectories (ICE)
Measures impact on accuracy:
- Shuffle each feature
- Measure accuracy degradation
- Importance = baseline accuracy - shuffled accuracy
- Shows which features matter most to the model
SHAP-style waterfall chart:
- Base score + feature contributions
- Shows how each feature pushed prediction higher/lower
- Suggests changes to flip prediction
PSI = Ξ£ (Current% - Reference%) * ln(Current% / Reference%)
- Thresholds: <0.1 (stable), 0.1-0.25 (warning), >0.25 (alert)
- Per-feature + per-time-period tracking
Implemented in PSI calculation:
- Measures difference between distributions
- Foundation for drift detection
- Histogram + KDE overlays
- Reference (training) vs. Current (production)
- Interactive feature selector
Time Γ Feature matrix showing PSI evolution:
- Identifies when/which features drift
- Color intensity = drift severity
- Positive prediction rate should be equal across groups
- Formula: P(Ε·=1 | group A) β P(Ε·=1 | group B)
- True Positive Rate (TPR) should be equal across groups
- Focuses on false negatives (missing positive cases)
- Ratio of selection rates: minority group / majority group
- Legal threshold: 0.8 to 1.25 (80% rule)
- Outside range indicates potential discrimination
- Download
index.htmlto your machine - Open in any modern browser (Chrome, Firefox, Safari, Edge)
- No server required β everything runs client-side
Performance Tab:
- View model metrics for each production model
- Click model cards to switch between Churn/Loan/Demand models
- Hover over performance chart to see exact metrics
Explainability Tab:
- Scroll through feature importance bar chart
- Examine SHAP beeswarm plot to understand feature impacts
- Use dropdown to explore PDP/ICE for different features
Drift Detection Tab:
- View heatmap showing which features drifted over time
- Check PSI bar chart against thresholds
- Use dropdown to compare distributions for specific features
Fairness & Bias Tab:
- Select demographic group (Age/Gender/Region)
- Compare prediction rates across protected groups
- Check disparate impact ratios
What-If Analysis Tab:
- Adjust sliders to explore different customer profiles
- Watch prediction update in real-time
- View sensitivity analysis to see feature importance
- Click "What changes would flip prediction?" for actionable insights
Model Comparison Tab:
- Select two model versions to compare
- View metric deltas with color coding (green=better)
- Examine radar chart for multi-metric comparison
- Scroll to see version history trends
{
age: 35,
income: 60,
tenure: 5,
usage_frequency: 25,
support_tickets: 3,
payment_days_overdue: 0,
account_balance: 5000,
monthly_charges: 65,
contract_type: "Month-to-month",
internet_service: "Fiber optic",
churn_probability: 0.35, // synthetic label
churn: 0 // binary outcome
}- Same features as training
- Applied drift transformations (Gaussian noise)
- Different distribution properties (enables drift detection demo)
- Dark Background:
#0f172a(slate-950) - Card Background:
#1e293b(slate-800) - Primary:
#3b82f6(blue-500) - Secondary:
#10b981(emerald-500) - Warning:
#f59e0b(amber-500) - Danger:
#ef4444(red-500)
- Font Family: System sans-serif (macOS/Windows/Linux compatible)
- Responsive sizing: 1.5rem headers β 0.85rem labels
- Mobile-optimized: Tablet (768px) and mobile breakpoints
- Desktop (1200px+): 3-column grid layouts
- Tablet (768-1199px): 2-column grids
- Mobile (<768px): Single column, stacked tabs
Charts automatically resize on window resize using Plotly's responsive mode.
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
- All Chromium-based browsers
- Mobile browsers (iOS Safari, Chrome Android)
This dashboard demonstrates:
-
ML Governance Skills
- Model registry management
- Performance monitoring
- Drift detection
-
Explainability (XAI)
- SHAP-style visualizations
- Feature importance methods
- Local vs. global explanations
-
Data Analysis
- Statistical distributions
- Fairness metrics
- Hypothesis testing (threshold analysis)
-
Software Engineering
- Single-file architecture
- Algorithm implementation in JS
- Responsive UI design
- Data visualization
-
Business Understanding
- What-if analysis for business decisions
- Fairness implications
- Model trade-offs
MIT License β Free to use, modify, and distribute.
Mayank Joshi MSc Business Analytics GitHub: mayankjoshiii
- SHAP: Model-agnostic feature importance
- PDP/ICE: Partial Dependence Plots from scikit-learn
- PSI: Population Stability Index (credit risk monitoring)
- Fairness Metrics: AI Fairness 360 (IBM)
- Plotly.js: Interactive visualization library
- Logistic Regression: Classification baseline
This is a portfolio project. For suggestions or improvements, please open an issue on GitHub.
Last Updated: March 2026 Status: Production-ready for portfolio demonstration