Pod.ai Submission | April 2026
Lead Data Scientist Review Version | Classification: INTERNAL
GovShield is a production-grade, AI-powered fraud detection system designed for government procurement auditing. It combines a Hybrid Ensemble (XGBoost + MLP) with SMOTE class balancing and SHAP explainability into a fully interactive Streamlit dashboard.
| Component | Technology |
|---|---|
| Frontend | Streamlit + Glassmorphism CSS |
| Gradient Boosting | XGBoost 2.0 |
| Deep Learning | Keras MLP (256→128→64) |
| Class Balancing | SMOTE (imbalanced-learn) |
| Explainability | SHAP TreeExplainer |
| Visualisation | Plotly |
- Python 3.10 or higher
pippackage manager- ~4 GB RAM recommended (for MLP training + SHAP computation)
# Option A: clone if hosted on git
git clone https://github.com/your-org/govshield.git
cd govshield
# Option B: navigate to your local directory
cd "d:\Palani\My creativity\GovAI"# Create virtual environment
python -m venv venv
# Activate on Windows
venv\Scripts\activate
# Activate on Linux / macOS
source venv/bin/activatepip install -r requirements.txt⏱️ First install may take 3–7 minutes due to TensorFlow and XGBoost downloads.
Ensure GovShield_Logo.jpg is in the same directory as app.py:
GovAI/
├── app.py
├── GovShield_Logo.jpg ✅ required
├── requirements.txt
└── README.md
streamlit run app.pyThe app will open automatically in your default browser at:
http://localhost:8501
🔄 First load takes ~60–90 seconds while:
- Generating 50,000 synthetic procurement records
- Applying SMOTE oversampling
- Training XGBoost (300 estimators)
- Training MLP (256-128-64, early stopping)
- Caching all results (subsequent reloads are instant)
| Control | Description |
|---|---|
| Fraud Base Rate | Adjust synthetic dataset imbalance (default: 1%) |
| Dataset Size | Choose 10K / 25K / 50K records |
| Decision Threshold | Fraud probability cutoff (default: 0.5) |
- Density Heatmap: Fraud vs legitimate case clustering in Risk/Deviation space
- Feature Distributions: Per-feature histograms comparing fraud and legitimate patterns
- Probability Distribution: Ensemble score separation on the test set
- Set procurement case parameters using sliders
- Click "🚀 Run Analysis" to trigger the Hybrid Ensemble
- View the Risk Meter (Green → Yellow → Red gauge)
- See XGBoost, MLP, and Ensemble scores separately
- Select any high-risk case from the dropdown
- View Top 5 Red Flag Contributors (SHAP bar chart)
- Understand per-feature contribution to the fraud score
- Review Global Feature Importance across all test cases
Training Data Split:
Original: 40,000 records (99% legit, 1% fraud = 400 fraud cases)
After SMOTE: 79,600 records (50% legit, 50% fraud)
SMOTE generates synthetic fraud cases by interpolating between real fraud
samples and their k=5 nearest fraud neighbors in feature space.
Input Features (12) → StandardScaler
│
┌────┴────┐
│ │
XGBoost Keras MLP
(n=300) 256→128→64→sigmoid
│ │
└────┬────┘
│
Average Probability
│
Fraud Score [0-1]
XGBoost Model → TreeExplainer → SHAP Values per case
│
┌────────────┼────────────┐
Feature 1 Feature 2 Feature 3
(contribution) (contribution)(contribution)
│
Top 5 Red Flag Bar Chart
GovAI/
├── app.py # Main Streamlit application
├── GovShield_Logo.jpg # Brand logo (sidebar + header)
├── requirements.txt # Pinned library versions
└── README.md # This file
All model parameters are configurable via the Sidebar UI at runtime. For programmatic override, edit these constants in app.py:
# Dataset
n_samples = 50_000 # Total synthetic records
fraud_ratio = 0.01 # 1% base fraud rate
# XGBoost
n_estimators = 300
max_depth = 6
learning_rate = 0.05
# MLP
epochs = 30
batch_size = 512
dropout_rate = 0.3 # Layers 1 & 2
dropout_rate2 = 0.2 # Layer 3Results vary slightly due to stochastic MLP training.
| Metric | Value |
|---|---|
| ROC-AUC | ~0.97–0.99 |
| Fraud Precision | ~0.78–0.88 |
| Fraud Recall | ~0.82–0.92 |
| Accuracy | ~0.99 |
| Package | Version | Purpose |
|---|---|---|
streamlit |
1.34.0 | Web dashboard framework |
xgboost |
2.0.3 | Gradient boosted trees |
tensorflow |
2.16.1 | MLP neural network |
imbalanced-learn |
0.12.3 | SMOTE resampling |
shap |
0.45.1 | Model explainability |
plotly |
5.22.0 | Interactive charts |
scikit-learn |
1.4.2 | Preprocessing, metrics |
- Data Leakage Prevention: StandardScaler is fit only on training data; SMOTE is applied only on training data. The test set is held completely clean.
- SHAP Computation: TreeExplainer uses the XGBoost component (exact Shapley values). MLP SHAP would require a KernelExplainer (slower) — available on request.
- Caching Strategy:
@st.cache_dataon data generation and@st.cache_resourceon models ensures single training per session. - Thread Safety:
n_jobs=-1on XGBoost uses all CPU cores. Reduce if running in a single-threaded pod.
GovShield v2.0 — © 2026 Government AI Division | Pod.ai Submission