Views
No views yet
app_student.py / utils_student.py / retrain_student.py track for course readers, and a fresh full-dataset retrain (99,999 samples — 69,999 train / 30,000 test) producing a re-tuned classification threshold of 0.3714. v2 is deployed as its own HuggingFace Space at VoltageVagabond/spam-xai-classifier-v2.1# Install dependencies
2pip install -r requirements.txt
3
4# Train the model (first run only — produces models/voting_model.joblib)
5python3 train_ensemble.py
6
7# Launch the Gradio web app
8python3 app.py
9
10# Or open the student teaching notebook
11jupyter notebook notebooks/spam_classifier_xai_student.ipynb.command files in Finder:launch-gradio.command — opens the Gradio web UI in your browserlaunch-notebook.command — opens the student notebook in Jupyterlaunch-app.command — opens the legacy Streamlit app (kept for reference; the active UI is launch-gradio.command)retrain-fast.command — quick retrain (~2-5 min, single RF, no grid search)retrain-full.command — full retrain (~15-30 min, voting ensemble + grid search)1python3 retrain.py --mode fast # quick retrain, single RF
2python3 retrain.py --mode full # full retrain, voting ensemble + grid search
3python3 retrain.py --mode full --no-feedback # full retrain, ignore user feedback logdata/feedback/feedback_log.csv and merges them into the training data with 5x weighting.| Model | Accuracy | F1 Score |
|---|---|---|
| Random Forest | 97.75% | 0.976 |
| Logistic Regression | 96.57% | 0.964 |
| SVM (LinearSVC + calibration) | 96.89% | 0.967 |
| VotingClassifier (deployed) | 97.40% | 0.973 |
models/optimal_threshold.joblib written by train_ensemble.py).| Notebook | Purpose |
|---|---|
notebooks/spam_classifier_xai_student.ipynb | Main teaching notebook (turn-in artifact for the course). Full XAI walkthrough with LIME, SHAP, ELI5, and a feature reduction experiment based on Kuzlu et al. 2020 |
notebooks/spam_classifier_gradio.ipynb | Shorter pipeline focused on the ensemble model and Gradio deployment |
docs/references/how-to.html — full reference index with clickable links to all local PDFs (LIME, SHAP, TreeSHAP, Kuzlu et al., 5 spam-detection papers) and HTML guides (sklearn user guide, Gradio quickstart, HF Spaces docs, Molnar Interpretable ML book)docs/07-code-sources-reference.md — markdown version of the references with citation entriesCHANGELOG.md — full project history from v0.1 (Streamlit) through v1.1 (merged Gradio)../spam-classifier-mlx/ — Apple MLX LoRA fine-tune of Qwen3.5-0.8B../spam-classifier-liquid/ — HuggingFace TRL+PEFT LoRA fine-tune of Liquid AI LFM2.5-1.2BBalfour, D. (2026). Spam Email Classifier with Explainable AI.
ENGT 375 Applied Machine Learning project, Old Dominion University, Spring 2026.
https://huggingface.co/spaces/VoltageVagabond/spam-xai-classifier-v2