From Notebooks to Professional ML Systems
π Location: 2_Classification/
π― Prerequisite: Module 1: Regression Mastery
β‘οΈ Next Module: Module 3: Neural Networks from Scratch
Welcome to the Classification Module of SAIR β where you transition from experimental notebooks to production-ready ML systems with professional pipelines and deployment architecture.
- You've mastered regression and want to tackle classification problems
- You're ready to build professional ML pipelines
- You want to learn industry best practices for ML systems
- You're preparing for ML engineering roles
- You've built classification models but want production experience
- You're familiar with sklearn but want pipeline architecture skills
- You want to add MLflow and modular design to your toolkit
These production tools transform your ML code from experiments to enterprise-ready systems.
| Lecture | Focus | Time Estimate | Mastery Level |
|---|---|---|---|
Lecture_4.ipynb |
Classification from Scratch | 4-5 hours | Essential |
Lecture_5.ipynb |
Production Pipeline System | 5-6 hours | Professional |
Pipeline/ System |
Modular Architecture | 6-8 hours | Industry Ready |
Start with: Lecture_4.ipynb
- Implement logistic regression from first principles
- Understand classification metrics and evaluation
- Build intuition for decision boundaries and probability
Continue with: Lecture_5.ipynb
- Transform notebooks into modular code
- Learn configuration management
- Set up experiment tracking and hyperparameter tuning
Master with: Pipeline/ system
- Build end-to-end ML pipeline
- Implement professional project structure
- Deploy with Streamlit applications
After completing this module, you will be able to:
| Skill | Where You Build It |
|---|---|
| Implement logistic regression from scratch | Lecture_4.ipynb |
| Interpret classification metrics: precision, recall, F1, ROC-AUC | Lecture_4.ipynb |
| Transform a notebook into a modular ML codebase | Lecture_5.ipynb |
| Design a configuration-driven pipeline | Pipeline/ |
| Run grid search and hyperparameter tuning at scale | Pipeline/models/ |
| Compare experiments in MLflow and select the best model | Pipeline/ |
| Deploy a classifier as a Streamlit web app | Pipeline/streamlit_app/ |
"From experimental code to production systems."
At SAIR, we believe modular, maintainable code separates hobby projects from professional systems. This module teaches you to architect ML solutions that scale and can be maintained by teams.
This is where you become an ML engineer, not just a model builder.
# 1. Start with classification fundamentals
jupyter notebook Lecture_4.ipynb
# 2. Learn pipeline transformation
jupyter notebook Lecture_5.ipynb
# 3. Explore the production pipeline
cd Pipeline
python run_pipeline.py# Dive directly into professional architecture
cd Pipeline
python run_pipeline.py
# Run the Streamlit app
uv run streamlit run streamlit_app/app.py# Test the breast cancer pipeline
python breast_cancer_pipline.pyThe Pipeline/ directory contains a complete, production-ready ML system that transforms Lecture 5 concepts into a professional codebase.
- β Modular Architecture - Separate data, models, config, utils
- β Advanced Feature Engineering - Custom transformers for domain-specific features
- β Multi-Model Training - 7+ algorithms with systematic comparison
- β Hyperparameter Tuning - Cross-validation and optimization
- β MLflow Experiment Tracking - Reproducible experiments
- β Streamlit Deployment - Interactive web application
Pipeline/
βββ config/ # Configuration Management
β βββ config.py # Centralized settings and paths
β βββ __init__.py
βββ data/ # Data Processing
β βββ load_data.py # Data ingestion and splitting
β βββ preprocessing.py # Cleaning & preparation pipelines
β βββ feature_engineering.py # Custom feature creation
β βββ raw/ # Source datasets
βββ models/ # ML Modeling
β βββ base_model.py # Abstract base classes
β βββ train_model.py # Training orchestration
β βββ evaluate_model.py # Comprehensive evaluation
β βββ hyperparameter_tuning.py # Systematic optimization
βββ utils/ # Shared Utilities
β βββ mlflow_utils.py # Experiment tracking helpers
βββ streamlit_app/ # Deployment
β βββ app.py # Web interface for predictions
βββ run_pipeline.py # Main execution script
cd Pipeline
# Execute full pipeline
python run_pipeline.py --mode full
# Or run specific steps
python run_pipeline.py --mode preprocessing # Data only
python run_pipeline.py --mode training # Models only
python run_pipeline.py --mode evaluation # Evaluation onlymlflow ui --backend-store-uri mlruns
# Open http://localhost:5000 in your browserApply the pipeline architecture to a classification problem of your choice, inspired by the Spaceship Titanic example.
- β Implement modular pipeline structure
- β Advanced feature engineering for your domain
- β Multi-model comparison and selection
- β MLflow experiment tracking
- β Streamlit deployment interface
- β Professional documentation
- π₯ Medical Diagnosis - Patient outcome prediction
- π³ Fraud Detection - Transaction classification
- π§ Spam Filter - Email categorization system
- π Customer Churn - Retention prediction
- π― Sentiment Analysis - Review classification
- π Custom Dataset - Your own classification problem!
Study the Pipeline/ structure and adapt it for your project:
- Replace dataset loading in
data/load_data.py - Customize feature engineering in
data/feature_engineering.py - Modify model portfolio in
models/base_model.py - Update the Streamlit app for your domain
The included Pipeline/ demonstrates exactly what you'll build:
- Configuration Management: Centralized settings in
config.py - Feature Engineering: Custom
SpaceshipFeatureEngineerclass - Model Portfolio: 7+ algorithms with hyperparameter tuning
- Experiment Tracking: MLflow for reproducibility
- Modular Design: Each component independently testable
After studying this pipeline, you'll be able to:
β
Build modular ML pipelines from scratch
β
Implement domain-specific feature engineering
β
Compare multiple models systematically
β
Track experiments with MLflow
β
Create reproducible research
β
Structure projects for collaboration
# In your project, replace Spaceship Titanic specifics:
# data/load_data.py β Your dataset loading
# data/feature_engineering.py β Your domain features
# models/base_model.py β Your model portfolio
# streamlit_app/app.py β Your application interfaceWhen you run the pipeline, MLflow logs every experiment. Here's how to interpret the results:
# Open the MLflow dashboard
mlflow ui --backend-store-uri Pipeline/mlruns
# Then open: http://localhost:5000| Metric | What It Means | Good Range |
|---|---|---|
val_accuracy |
Accuracy on held-out validation set | >85% for most problems |
val_f1 |
Harmonic mean of precision and recall | >0.80 for balanced classes |
val_roc_auc |
Area under the ROC curve | >0.85 is strong |
train_accuracy vs val_accuracy |
Gap > 10% = overfitting | Keep gap under 5% |
Model selection rule: pick the model with the best val_f1, not train_accuracy. High training accuracy with low val accuracy = overfitting β try more regularization or less complexity.
| Problem | Likely Cause | Fix |
|---|---|---|
mlflow.exceptions.MlflowException |
Tracking dir not found | Run pipeline from the Pipeline/ directory |
| Streamlit app shows stale predictions | Old model pickle loaded | Delete models/ and re-run --mode full |
KeyError in feature engineering |
Column renamed in your dataset | Update column names in config.py |
| Hyperparameter tuning takes too long | Too many combinations | Reduce param_grid in models/base_model.py |
Class imbalance warning |
Unequal class distribution | Add class_weight='balanced' to your estimator |
Building pipelines can be challenging - we're here to help!
Get architecture reviews, pipeline feedback, and join deep-dive sessions on ML engineering best practices. Share your pipeline adaptations and get inspired by others!
β Begin with Lecture_4.ipynb
β Study the Pipeline/ example thoroughly
β Run breast_cancer_pipline.py
β Create your project following the pipeline pattern
β Continue to Module 3: Neural Networks from Scratch
| Resource | Purpose | When to Use |
|---|---|---|
Pipeline/run_pipeline.py |
Complete pipeline example | Learning architecture |
Pipeline/streamlit_app/app.py |
Production deployment | Building your UI |
Pipeline/config/config.py |
Configuration template | Project setup |
breast_cancer_pipline.py |
Integrated example | Testing end-to-end flow |
"Ψ§ΩΨ³ΩΨ±" - "Walking on a road"
Professional ML is about systems, not just models. This pipeline example shows you the path from notebooks to production.
Study the pattern, then build your masterpiece! ποΈ
π Next Step: Module 3: Neural Networks from Scratch
3_Classification/
β
βββ π README.md # This guide
βββ π― Lecture_4.ipynb # Classification from Scratch
βββ π Lecture_5.ipynb # Production Pipeline Design
βββ π§ breast_cancer_pipline.py # Integrated Example
βββ ποΈ Pipeline/ # Professional Architecture
βββ config/ # Configuration Management
βββ data/ # Data Processing
βββ models/ # ML Modeling
βββ utils/ # Shared Utilities
βββ streamlit_app/ # Deployment Interface
βββ run_pipeline.py # Main Execution
βββ README.md # Detailed Documentation
βββ requirements.txt # Dependencies