| Feature | Type | Range |
|---|---|---|
| Study Hours | Continuous | 0–12 hrs |
| Attendance | Continuous | 30–100% |
| Previous Grades | Continuous | 0–100 |
| Parental Education | Ordinal | 0–4 |
| Sleep Hours | Continuous | 3–12 hrs |
| Motivation | Ordinal | 1–5 |
| Absences | Continuous | 0–30 |
| Internet Access | Binary | 0/1 |
| Tutoring | Binary | 0/1 |
Data Collection
Student data is collected including academic, behavioral, and socio-economic factors (14 features total).
Preprocessing
Features are normalized using StandardScaler. Categorical variables are label encoded. Data is split 80/20 for training and testing.
Model Training
Random Forest with 200 trees is trained. Feature importance is computed. 5-fold cross-validation ensures reliability.
Prediction
Given new student inputs, the model classifies into A/B/C/D/F grades with confidence probability scores.
Recommendations
Based on weak feature values, the system generates personalized, actionable study recommendations.
POST /predict
Predict academic performance for a student.
POST http://localhost:5000/predict
Content-Type: application/json
{
"age": 19,
"gender": 1,
"study_hours": 6,
"attendance": 82,
"prev_grades": 72,
"parental_education": 2,
"internet_access": 1,
"extracurricular": 1,
"sleep_hours": 7.5,
"health": 4,
"absences": 3,
"tutoring": 1,
"parental_support": 3,
"motivation": 4
}
// Response
{
"success": true,
"predicted_grade": "B",
"grade_category": "Good",
"confidence": 78.5,
"performance_score": 81.2,
"recommendations": ["Keep up the good work!"],
"feature_importance": [
{ "feature": "Study Hours", "importance": 24.5 },
...
]
}
GET /stats
Returns model statistics and info.
GET http://localhost:5000/stats
// Response
{
"model_type": "Random Forest Classifier",
"accuracy": 0.89,
"features_used": 14,
"training_samples": 2000,
"grade_classes": ["A (90-100)", "B (75-89)", "C (60-74)", "D (45-59)", "F (<45)"]
}
POST /compare
Compare performance across multiple students.
POST http://localhost:5000/compare
Content-Type: application/json
{
"students": [
{ "name": "Alice", "study_hours": 8, ... },
{ "name": "Bob", "study_hours": 3, ... }
]
}