Learn every major ML algorithm with math intuition, from-scratch implementation, and real-world projects.
Most ML tutorials give you either:
- π΄ Copy-paste code with no explanation of why it works, or
- π΄ Dense math papers with no practical implementation
These notebooks bridge that gap. Every notebook gives you:
β Plain English explanation β β Mathematical derivation β β Visual intuition β β From-scratch NumPy code β β Production sklearn code
Whether you're a complete beginner or an experienced engineer brushing up for an interview, this is your one-stop reference.
| π Students | π¨βπ» Engineers | π― Interview Prep |
|---|---|---|
| Learning ML from scratch with one structured, progressive path | Quickly look up syntax, parameters, and best practices mid-project | Algorithms explained conceptually + common interview Q&A included |
ml-mastery/
β
βββ 01_libraries/ # π¦ Core Python libraries for ML
β βββ numpy.ipynb # Arrays, operations, broadcasting, indexing
β βββ pandas.ipynb # DataFrames, cleaning, groupby, merging
β βββ matplotlib.ipynb # Plots, subplots, styling, saving figures
β
βββ 02_ml_concepts/ # π§ ML algorithms with math intuition + code
β βββ linear_regression.ipynb # OLS, gradient descent, cost function
β βββ logistic_regression.ipynb # Sigmoid, log loss, decision boundary
β βββ decision_trees.ipynb # Entropy, Gini, information gain
β βββ random_forest.ipynb # Bagging, feature importance, OOB error
β βββ svm.ipynb # Hyperplane, margin, kernel trick
β βββ knn.ipynb # Distance metrics, choosing K
β βββ naive_bayes.ipynb # Bayes theorem, conditional probability
β βββ unsupervised.ipynb # K-Means, DBSCAN, PCA, t-SNE
β βββ feature_engineering.ipynb # Encoding, scaling, selection, pipelines
β βββ model_evaluation.ipynb # Metrics, cross-validation, bias-variance
β
βββ 03_projects/ # ποΈ End-to-end ML projects on real datasets
β βββ titanic.ipynb # Binary classification β survival prediction
β βββ house_price.ipynb # Regression β price prediction
β
βββ extras/ # π Quick reference materials
β βββ cheatsheet.md # Most-used commands across all libraries
β βββ interview_qa.md # Common ML interview questions and answers
β
βββ requirements.txt # All dependencies
βββ CONTRIBUTING.md # How to contribute
βββ README.md # Project README
Click a notebook name to view it on GitHub, or click the Colab badge to open it directly in Google Colab β no setup required.
| Notebook | What You'll Learn | Open |
|---|---|---|
| numpy.ipynb | Arrays, broadcasting, vectorized math, indexing | |
| pandas.ipynb | DataFrames, data cleaning, groupby, merging | |
| matplotlib.ipynb | Plots, subplots, styling, saving figures |
| Notebook | What You'll Learn | Open |
|---|---|---|
| linear_regression.ipynb | OLS, gradient descent, cost function, RΒ² | |
| logistic_regression.ipynb | Sigmoid, log loss, decision boundary | |
| decision_trees.ipynb | Entropy, Gini impurity, information gain | |
| random_forest.ipynb | Bagging, feature importance, OOB error | |
| svm.ipynb | Hyperplane, margin maximization, kernel trick | |
| knn.ipynb | Distance metrics, K selection, curse of dimensionality | |
| naive_bayes.ipynb | Bayes theorem, conditional probability, Laplace smoothing | |
| unsupervised.ipynb | K-Means, DBSCAN, PCA, t-SNE dimensionality reduction | |
| feature_engineering.ipynb | Encoding, scaling, feature selection, pipelines | |
| model_evaluation.ipynb | Metrics, cross-validation, bias-variance tradeoff |
| Notebook | Problem Type | Dataset | Open |
|---|---|---|---|
| titanic.ipynb | Binary Classification | Titanic survival | |
| house_price.ipynb | Regression | Housing prices |
Follow this order if you are starting from scratch:
π¦ NumPy β Pandas β Matplotlib
β
π§ Linear Regression β Logistic Regression
β
Decision Trees β Random Forest
β
SVM β KNN β Naive Bayes
β
Feature Engineering β Model Evaluation
β
Unsupervised Learning
β
ποΈ Projects (Titanic β House Price)
Pro tip: Don't skip the libraries section. Everything in
02_ml_concepts/depends heavily on NumPy and Pandas.
Every notebook in 02_ml_concepts/ follows this proven structure:
| Section | What You Get |
|---|---|
| π£οΈ Concept Overview | Plain English explanation of what the algorithm does and when to use it |
| π Math Intuition | The actual math β cost function, derivation, key equations |
| π Visual Intuition | Plots and diagrams built from scratch to show what is happening |
| π» Code from Scratch | Full implementation using only NumPy β no black boxes |
| βοΈ Sklearn Implementation | The production-ready way with all parameters explained |
| What goes wrong, why, and how to fix it | |
| π§© Exercises | Practice problems with worked solutions |
Option 1 β Google Colab (recommended, zero setup)
Click any "Open in Colab" badge above. Everything runs instantly in your browser β no installation needed.
Option 2 β Run Locally
git clone https://github.com/himanshu231204/ml-mastery.git
cd ml-mastery
pip install -r requirements.txt
jupyter notebook| Resource | Description |
|---|---|
| π Cheatsheet | Most-used NumPy, Pandas, Matplotlib, and sklearn commands with output examples |
| π― Interview Q&A | Common ML interview questions with detailed answers |
| Library | Version | Purpose |
|---|---|---|
numpy |
β₯ 1.24 | Array operations, mathematical computing |
pandas |
β₯ 2.0 | Data manipulation and analysis |
matplotlib |
β₯ 3.7 | Data visualization |
seaborn |
β₯ 0.12 | Statistical data visualization |
scikit-learn |
β₯ 1.3 | Machine learning algorithms |
scipy |
β₯ 1.11 | Scientific and statistical computing |
Contributions are welcome and appreciated! Whether it's fixing a typo, adding a new algorithm notebook, or improving an explanation β every contribution helps.
See CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License β free to use, share, and modify with attribution. See LICENSE for details.
If this repository helped you learn or saved you time, please consider:
- β Starring this repo β it helps others discover it
- π΄ Forking it β to build your own ML reference
- π’ Sharing it β with friends, colleagues, or on social media
Every star motivates continued improvement. Thank you! π