TSV 3343 — Big Data Analytics and Development — Mini Project (15%)
A complete data-science pipeline that predicts whether a university student is "At Risk" or "Not At Risk" academically, and serves live predictions through an interactive Quarto-Shiny web app.
| Aspect | Detail |
|---|---|
| Domain | Higher Education / Student Performance |
| Task | Binary Classification |
| Target | academic_risk → At Risk / Not At Risk |
| Dataset | 12,084 records × 14 attributes |
| Model | XGBoost Classifier (calibrated) |
| Explainability | SHAP (TreeExplainer) |
| Deployment | Quarto-Shiny interactive document |
| File / Folder | Purpose |
|---|---|
P01.qmd |
Full analysis notebook: EDA, cleaning, feature engineering, model training, evaluation, calibration, SHAP analysis |
P01_shiny.qmd |
Interactive web app — live prediction form, SHAP waterfall + beeswarm, CSV batch upload, CSV/PDF report download |
P01_data_cleaned.csv |
Cleaned dataset (12,001 rows × 16 features) |
model_py312.pkl |
Trained XGBoost model (Python 3.12-safe pickle) |
scaler_py312.pkl |
StandardScaler fitted on the 16 features (Python 3.12-safe pickle) |
sample_students_strings.csv |
Example batch-upload CSV with human-readable values (Male/Female, Yes/No) |
requirements.txt |
Python dependencies |
_quarto.yml |
Quarto project configuration |
Download and install Quarto 1.10+ from https://quarto.org/docs/get-started/
conda create -n jupyter_env python=3.12
conda activate jupyter_env
pip install -r requirements.txtThe app loads these at startup:
model_py312.pkl— XGBoost classifierscaler_py312.pkl— StandardScaler
Both are already included in the project folder.
quarto preview P01.qmdquarto preview P01_shiny.qmdThen open http://localhost:4200 in your browser.
- Student Profile — Age, Gender, Programme
- Academic Record — Attendance %, Assignment Avg, Quiz Avg, Midterm Score, Previous GPA
- Habits & Circumstances — Study Hours/Week, Absences, Internet Access, Extracurricular
Live text showing:
- Prediction:
At Risk/Low Risk - Probability: e.g.
0.3447 - Top 3 SHAP drivers
Shows how each feature pushes this specific student's prediction up or down.
- Red bars = push risk up
- Blue bars = push risk down
f(x)= final prediction scoreE[f(X)]= baseline average prediction
Grey numbers on the left (e.g. -0.200 = age) are not accuracy — they are the standardized (scaled) values your model sees:
scaled = (raw_value - dataset_mean) / dataset_std
Example: age 21 becomes -0.200 because 21 is slightly below the dataset mean (21.458).
Global view of which features matter most across all students.
- Y-axis = feature names, sorted by importance
- X-axis = SHAP value (impact on model output)
- Each dot = one student
- Color = feature value (red = high, blue = low)
How to read it:
- Top features have the biggest effect on predictions
- Wide spread = feature can strongly push risk up or down
- Narrow cluster = feature has little effect
- Dots on the right (positive) = increase risk; dots on the left (negative) = decrease risk
Upload a CSV with student data. The app:
- Computes
engagement_scoreif missing - Maps
Male/Female→0/1,Yes/No→1/0 - One-hot encodes
programme - Scales features with the saved
StandardScaler - Returns probability + label for each row
Use sample_students_strings.csv to test.
- CSV — batch prediction results
- PDF — single-input report (text summary + waterfall + beeswarm)
| Metric | Value |
|---|---|
| Algorithm | XGBoost |
| Calibration | Isotonic |
| Decision threshold | 0.1546 |
| Test recall | 0.6319 |
| Test precision | 0.2367 |
| Test F1 | 0.3444 |
| Test accuracy | 0.6543 |
| Confusion matrix | TN 1353 / FP 703 / FN 127 / TP 218 |
age, gender, attendance_pct, assignment_avg, quiz_avg, midterm_score,
study_hours_week, previous_gpa, absences, internet_access, extracurricular,
prog_Computer Science, prog_Data Science, prog_IT, prog_Software Engineering,
engagement_score
The model was trained on scaled data, so all inputs are transformed:
scaled = (raw - mean) / std
This is why the waterfall shows small decimal numbers instead of the raw slider values.
- Waterfall — explains one specific prediction (this student)
- Beeswarm — explains the model globally (all students)
The raw XGBoost probability is adjusted with isotonic regression so the predicted probability better matches real-world frequencies.
| Problem | Fix |
|---|---|
could not convert string to float: 'Male' |
The app now auto-maps Male/Female and Yes/No in CSV upload. Use sample_students_strings.csv as a template. |
Duplicate output ID |
Restart quarto preview and open one browser tab. |
IProgress not found warning |
Suppressed automatically by warnings.filterwarnings("ignore") in the setup cell. |
More column widths than children |
Suppressed automatically. Layout is verified working. |
| Pickle load error | Use model_py312.pkl and scaler_py312.pkl (rebuilt for Python 3.12). |
- Lundberg, S. M., & Lee, S.-I. (2017). A Unified Approach to Interpreting Model Predictions. NeurIPS.
- Chen, T., & Guestrin, C. (2016). XGBoost: A Scalable Tree Boosting System. KDD.
- Pedregosa et al. (2011). Scikit-learn: Machine Learning in Python. JMLR.
Author: Nik Abdul Aqmal Bin Zunaidi Group: 01 Lecturer: Assoc. Prof. Dr. Zuraini Zainol Course: TSV 3343 — Big Data Analytics and Development