How loki-git001/email_spamclassification works
1. This repository is a small machine-learning application for email spam classification. The core architecture is split into data preparation, feature engineering, model training, and a packaged inference artifact.
2. The data layer is organized under dataset/ with a clear raw-to-processed boundary:
- dataset/raw/emails.csv is the source dataset.
- dataset/processed_data/emails_processed.csv is the cleaned/normalized version used downstream.
This suggests an offline preprocessing step rather than live data ingestion.
3. feature_engineering.py is the main code module in the repo and likely contains reusable text-cleaning and feature-construction logic. It acts as the shared transformation layer between the raw dataset and the training/inference stages.
4. The exploratory and experimental workflow is notebook-driven:
- eda.ipynb for dataset inspection and analysis.
- feature_extraction.ipynb for text/vector feature experimentation.
- train_model.ipynb for model selection and training.
These notebooks are the research/iteration side of the system, not the deployed runtime.
5. The trained model is persisted as models/svm_pipeline.joblib. That artifact indicates the deployed classifier is a scikit-learn pipeline, probably combining preprocessing/vectorization with an SVM classifier in a single serialized object.
6. app.py appears to be the runtime entrypoint for using the trained model. It likely loads models/svm_pipeline.joblib, accepts email text input, and returns a spam/ham prediction. In architecture terms, this is the inference boundary between user input and the saved model artifact.
7. The repository therefore has a simple flow:
raw email data -> preprocessing/feature engineering -> training notebooks -> serialized pipeline -> app.py inference.
The processed CSV sits in the middle as an intermediate, reproducible dataset.
8. The models/ directory is the model registry for this project, while dataset/processed_data/ is the curated training input. Those two directories define the main persisted state of the system.
9. requirements.txt and .devcontainer/devcontainer.json define the execution environment. This matters architecturally because the project likely depends on a Python ML stack, and the devcontainer provides a reproducible development setup.
10. images/model_selection/ and Email-Spam-Classification.pptx are supporting artifacts for documentation and presentation, not runtime components. They reflect the experimental/model-comparison process around the classifier.
11. Overall, this is an offline-trained, file-based ML application with no obvious external services or databases. The main architectural boundaries are between dataset processing, model training, and model serving via a lightweight local app.
Main entry points: feature_engineering.py Features · train_model.ipynb Train model · emails_processed.csv Processed data · requirements.txt Requirements
Components 12
Data
Offline dataset and curated training input
- Raw emails · Source email corpus
dataset/raw/emails.csv - Processed data · Cleaned and normalized dataset used downstream
dataset/processed_data/emails_processed.csv
Research
Notebook-driven exploration and training
- EDA · Dataset inspection and exploratory analysis
eda.ipynb - Feature exp. · Feature and vectorization experimentation
feature_extraction.ipynb - Train model · Model selection and training workflow
train_model.ipynb
Model
Persisted classifier artifact and related outputs
- SVM pipeline · Saved scikit-learn inference pipeline
models/svm_pipeline.joblib
Environment
Reproducible development and dependency setup
- Requirements · Python package dependencies
requirements.txt - Devcontainer · Containerized development environment
.devcontainer/devcontainer.json
Docs
Presentation and visual artifacts
- Model plots · Model-selection visual outputs
images/model_selection - Presentation · Project presentation artifact
Email-Spam-Classification.pptx
Other components
- Features · Shared text cleaning and feature construction logic
feature_engineering.py
Connections 15
- Raw emails → Features: clean · Raw data is transformed by the shared preprocessing layer
- Features → Processed data: produce · Feature and cleaning logic yields the curated dataset
- Processed data → EDA: inspect · Processed data supports exploratory analysis
- Processed data → Feature exp.: experiment · Curated data feeds feature engineering experiments
- Processed data → Train model: train · Training consumes the processed dataset
- Features → Feature exp.: reuse · Notebook experiments share the transformation logic
- Features → Train model: reuse · Training reuses the shared feature pipeline
- Train model → SVM pipeline: serialize · Training produces the persisted pipeline artifact
- Feature exp. → Model plots: export · Exploration generates comparison plots and figures
- Train model → Presentation: report · Training results are summarized in the presentation deck
- SVM pipeline → App: load · Inference app loads the serialized model
- Features → App: preprocess · Runtime input is normalized before prediction
- Requirements → Devcontainer: support · Dependencies and dev container define the working environment
- Requirements → App: run · Application runtime depends on the Python ML stack
- Requirements → Train model: run · Notebook training depends on the same environment