Predict student failure BEFORE it happens β with Explainable AI and Auto-Generated Intervention Plans.
In educational institutions, student failure often goes undetected until end-of-semester results, leaving no room for meaningful intervention. Faculty lack a proactive, data-driven tool to identify at-risk students early.
FAILSAFE is a web-based system where faculty upload student data and a trained ML model predicts failure risk β with Explainable AI (SHAP) making every prediction transparent β and auto-generated intervention plans guiding support.
| Component | URL |
|---|---|
| Frontend | failsafe-App |
| Backend API | failsafe-api-wvs6.onrender.com |
- UCI Student Performance Dataset β 649 students, 33 features
- Combined Math (
student-mat.csv) and Portuguese (student-por.csv) courses
| Category | Features |
|---|---|
| Academic | G1, G2 (period grades), failures, studytime |
| Attendance | absences, traveltime |
| Behavioral | Dalc, Walc (alcohol), goout, freetime, romantic |
| Family | Pstatus, famsup, famrel, Medu, Fedu, Mjob, Fjob |
| Demographics | age, sex, address, famsize, school |
XGBoost Classifier + SMOTEENN (Handling Imbalance)
βββ SMOTE: Synthetic Minority Oversampling
βββ ENN: Edited Nearest Neighbors (noise removal)
βββ Threshold Tuning: Optimal F2-score threshold
| Metric | Score |
|---|---|
| Accuracy | 92% |
| Fail Recall | 95% π₯ |
| ROC-AUC | 0.956 |
| False Alarms | 16 (acceptable) |
- Original ratio: 5.5:1 (Pass:Fail)
- SMOTEENN applied β Balanced training data
- Threshold tuned to 0.55 for optimal fail detection
Every prediction comes with 5 SHAP risk factors explaining exactly WHY a student is flagged:
| Feature | Impact | Direction |
|---|---|---|
| G2 | -4.59 | π΄ Risk |
| absences | -0.34 | π΄ Risk |
| studytime | +0.28 | π’ Protective |
Faculty see human-readable explanations:
- π΄ G2=4 β Strong risk factor
- π΄ absences=15 β Moderate risk
- π’ studytime=4 β Protective factor
Based on SHAP risk factors, the system generates personalised action plans:
| Risk Factor | Intervention | Priority |
|---|---|---|
| Low G1/G2 | Schedule remedial classes | High |
| High absences | Attendance monitoring program | High |
| Alcohol (Dalc/Walc) | Counselor referral | High |
| Past failures | Assign academic mentor | High |
| Family factors | Parent-teacher meeting | Medium |
Each plan includes: Action β Detail β Priority β Timeline
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β React Frontend (Vercel) β
β ββββββββββββ ββββββββββββ βββββββββββββββββββββββββ β
β β Upload β βDashboard β β Intervention Tracker β β
β β Module β β & Charts β β β β
β ββββββββββββ ββββββββββββ βββββββββββββββββββββββββ β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β REST API
βββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββ
β FastAPI Backend (Render) β
β ββββββββββββ ββββββββββββ ββββββββββββββββββββββββ β
β β Auth β β ML Model β β Intervention β β
β β Service β β Service β β Generator β β
β ββββββββββββ ββββββββββββ ββββββββββββββββββββββββ β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββ
β PostgreSQL (Supabase Cloud) β
β ββββββββββββ ββββββββββββ ββββββββββββββββββββββββ β
β β Users β βPredictionsβ β Students β β
β ββββββββββββ ββββββββββββ ββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Layer | Technology |
|---|---|
| Frontend | React.js, Recharts, Axios |
| Backend | FastAPI, Python 3.11 |
| ML | XGBoost, SHAP, Scikit-learn, Imbalanced-learn |
| Database | PostgreSQL (Supabase) |
| Auth | JWT, bcrypt |
| Deployment | Vercel (Frontend), Render (Backend) |
FAILSAFE/
βββ failsafe-backend/
β βββ main.py # FastAPI entry point
β βββ requirements.txt # Python dependencies
β βββ runtime.txt # Python version for Render
β βββ models/ # Trained model files
β βββ utils/
β β βββ model_loader.py # Load model & pipeline
β β βββ preprocessing.py # Data preprocessing
β β βββ pipeline.py # CompletePipeline class
β β βββ intervention.py # Intervention generator
β β βββ auth.py # JWT authentication
β βββ routes/
β β βββ predict.py # Prediction endpoints
β β βββ auth.py # Login/signup endpoints
β βββ database/
β βββ connection.py # Supabase connection
β βββ models.py # Database tables
β
βββ failsafe-frontend/
β βββ src/
β β βββ pages/
β β β βββ Dashboard.jsx # Main dashboard
β β β βββ LoginPage.jsx # Authentication
β β βββ components/
β β β βββ RiskChart.jsx # Pie & Bar charts
β β βββ App.jsx # Router setup
β βββ package.json
β
βββ colab_notebooks/
β βββ failsafe_model.ipynb # Model training notebook
β
βββ README.md
- Python 3.11+
- Node.js 18+
- Supabase account (free)
- Git
cd failsafe-backend
python -m venv failsafe_env
# On Windows:
failsafe_env\Scripts\activate
# On macOS/Linux:
source failsafe_env/bin/activate
pip install -r requirements.txt
uvicorn main:app --reloadcd failsafe-frontend
npm install
npm run devDATABASE_URL=postgresql://user:pass@host:6543/postgres
SECRET_KEY=your-secret-key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
| Goal | Status |
|---|---|
| Predict at-risk students using attendance, assignments & behavioral data | β |
| SHAP explanations for every prediction | β |
| Auto-generated personalised intervention plans | β |
| Faculty & HOD dashboard with risk trends | β |
Built with β€οΈ as part of the FAILSAFE project.