Machine Learning Module 1:
Overview This repository contains 5 complete machine learning projects implemented from scratch. Each project demonstrates core ML concepts with working code, visualizations, and clear explanations.
Projects Included
Linear Regression from Scratch → Implementation using only NumPy Cost Function Visualization → 3D “bowl-shaped” cost surface Gradient Descent Implementation → Optimization with learning rates Supervised vs Unsupervised → Side-by-side comparison California Housing → Real-world ML pipeline
Quick Start
Option 1: Run Locally (Recommended)
Step 1: Install Python Download Python 3.8 or higher from python.org Make sure “Add Python to PATH” is enabled
Step 2: Download Repository Using Git: git clone https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git
cd YOUR_REPO_NAME
Or download ZIP and extract
Step 3: Install Dependencies pip install numpy matplotlib pandas seaborn scikit-learn ipywidgets jupyter
Step 4: Launch Jupyter jupyter notebook
Step 5: Run Projects Open any .ipynb file Run cells using Shift + Enter Start with 00_INDEX.ipynb
Option 2: Run on Google Colab (No Installation)
Open notebook on GitHub Click “Open in Colab” OR go to colab.research.google.com Upload the notebook Run cells with Shift + Enter
Enable widgets in Colab: !pip install ipywidgets from google.colab import output output.enable_custom_widget_manager()
Repository Structure
ml-module-1/
00_INDEX.ipynb
project_1_linear_regression_scratch.ipynb project_2_cost_function_visualization.ipynb project_3_gradient_descent_implementation.ipynb project_4_supervised_vs_unsupervised.ipynb project_5_california_housing_real_data.ipynb
README.txt requirements.txt
images/ project1_fit.png project2_3d_surface.png ...
Setup Instructions
Windows pip install numpy matplotlib pandas seaborn scikit-learn ipywidgets jupyter cd C:\path\to\your\ml-module-1 jupyter notebook
Mac brew install python pip3 install numpy matplotlib pandas seaborn scikit-learn ipywidgets jupyter cd /path/to/your/ml-module-1 jupyter notebook
Linux sudo apt install python3-pip pip3 install numpy matplotlib pandas seaborn scikit-learn ipywidgets jupyter cd /path/to/your/ml-module-1 jupyter notebook
Testing Each Project
Project 1: Linear Regression Expected: scatter plot, regression line, cost decreasing graph Result: weights close to [5, 2.5] Success: R² > 0.9
Project 2: Cost Function Visualization Expected: 3D plot, contour plot, sliders Success: plots render correctly
Project 3: Gradient Descent Expected: cost decreases, learning rate comparison Success: stable convergence
Project 4: Supervised vs Unsupervised Expected: regression, clustering, classification visuals Success: clear comparison plots
Project 5: California Housing Expected: stats, heatmap, predictions vs actual Success: R² around 0.6
Troubleshooting
Error: numpy not found → run pip install numpy Error: sklearn not found → run pip install scikit-learn Jupyter not starting → pip install --upgrade jupyter Sliders not working → install ipywidgets and restart Dataset not loading → check internet connection
Colab Fix: !pip install ipywidgets from google.colab import output output.enable_custom_widget_manager()
Environment Test
import sys print(sys.version)
try: import numpy print("NumPy OK") except: print("Install NumPy")
try: import matplotlib print("Matplotlib OK") except: print("Install Matplotlib")
try: import sklearn print("scikit-learn OK") except: print("Install scikit-learn")
FAQ
Do I need to run all projects? No, each project is independent
How long does it take? 1–2 minutes per project
Is my data saved? No, everything runs locally
No installation option? Use Google Colab
Why duplicate classes? Each notebook is self-contained
Performance
Project 1 → ~30 sec, ~100 MB, no internet Project 2 → ~30 sec, ~150 MB, no internet Project 3 → ~30 sec, ~100 MB, no internet Project 4 → ~20 sec, ~100 MB, no internet Project 5 → ~60 sec, ~200 MB, internet required (first run)
Support
Check troubleshooting Ensure Python 3.8+ Install all dependencies Open GitHub issue if needed
License MIT License
Star the repo if you found it useful.
Built from scratch to demonstrate strong understanding of machine learning fundamentals.