This repository contains examples of popular machine learning algorithms implemented in Python with mathematics behind them being explained. Each algorithm has interactive Jupyter Notebook demo that allows you to play with training data, algorithms configurations and immediately see the results, charts and predictions right in your browser.
The purpose of this repository is not to implement machine learning algorithms by using 3rd party library one-liners but rather to practice implementing these algorithms from scratch and get better understanding of the mathematics behind each algorithm.
- Machine Learning
- Deep Learning
- Optimization Algorithms
- Paper Implement
- Deep Learning with Tensorflow
In supervised learning we have a set of training data as an input and a set of labels or correct answers for each training set as an output. Then we're training our model (machine learning algorithm parameters) to map the input to the output correctly (to do correct prediction). The ultimate purpose is to find such model parameters that will successfully continue correct input→output mapping (predictions) even for new input examples.
In regression problems we do real value predictions. Basically we try to draw a line/plane/n-dimensional plane along the training examples. In regression we deal with continuos as well as decreate data
- 📗 Math | Linear Regression - theory and links for further readings
▶️ Demo | Univariate Linear Regression
- 📗 Math | Polynomial Regression - theory and links for further readings
▶️ Demo | Univariate Polynomial Regression
▶️ Demo | Lasso/Ridge Regression -Both regressions are explained with Neural Network. But you can apply in any algorithm also.
SVM construct a hyper plane in high dimension which can be used for Classification , regression , or outlier detection.
- 📗 Math | SVM - theory and code
▶️ Demo | SVM Hard Margin - theory and code▶️ Demo | SVM Soft Margin - theory and code▶️ Demo | SVM Kernel Trick - theory and code▶️ Demo | SVM Sequential Minimal Optimization( SMO ) - theory and code▶️ Demo | SVM (Multi-class) - theory and code
- KNN (K — Nearest Neighbors) is one of many (supervised learning) algorithms used in data mining and machine learning, it’s a classifier algorithm where the learning is based “how similar” is a data (a vector) from other
- 📗 Math | KNN - theory
▶️ Demo | KNN - code from scratch.
In classification problems we split input examples by certain characteristic.
_Usage examples: benign-malignent-data, wine-quality, MNIST handwritten.
- 📗 Math | Logistic Regression - theory and links for further readings
▶️ Demo | Logistic Regression (Linear Boundary)▶️ Demo | Multivariate Logistic Regression | Wine-quality▶️ Demo | Multivariate Logistic Regression | Benign-Malignent
- 📗 Math | Naive Bayes Classifier - theory and links for further readings
▶️ Demo | Bivariate Naive Bayes Classifier | Benign-Malignent
-
▶️ Demo | Decision Tree | Wine-quality from scratch
Ensemble learning is a machine learning paradigm where multiple models (often called “weak learners”) are trained to solve the same problem and combined to get better results. The main hypothesis is that when weak models are correctly combined we can obtain more accurate and/or robust models.
Unsupervised learning is a branch of machine learning that learns from test data that has not been labeled, classified or categorized. Instead of responding to feedback, unsupervised learning identifies commonalities in the data and reacts based on the presence or absence of such commonalities in each new piece of data.
In dimentional reduction we select 'K' features from given 'n' features by using some techniques.
- 📗 Math | Principal Component Analysis - theory and explanation
▶️ Demo | Principal Component Analysis - code
-
📗 Theory | Non-negative Matrix Factorization - theory and explanation
-
▶️ Demo | Non-negative Matrix Factorization - OOP's implement -
▶️ Demo | Non-negative Matrix Factorization - simple implement from scratch
▶️ Demo | SVD - from scratch
Clustering is the task of dividing the population or data points into a number of groups such that data points in the same groups are more similar to other data points in the same group and dissimilar to the data points in other groups.
-
📗 Theory | K-Mean - theory
-
▶️ Demo | K-Mean - from scratch
Perceptron is similar to SVM it also construct a hyper plane in high dimension if data is linearly seperable.
- 📗 Theory | Perceptron - Theory of perceptron
▶️ Demo | Perceptron - code
- 📗 Theory | Artificial Neural Network - Theory of ANN
- 📗 Math | Regression with Artificial Neural Network - theory and code
▶️ Demo | Bivariate Classification with Artificial Neural Network▶️ Demo | Multivariate Classification with Artificial Neural Network using Sigmoid function▶️ Demo | Multivariate Classification with Artificial Neural Network using ReLu function▶️ Demo | Multivariate Classification with Artificial Neural Network ( DevnagariHandwrittenDataSet )- complete code from scratch ( Accuracy 73 % )▶️ Demo | Multivariate Classification with Artificial Neural Network ( MNIST )- complete code from scratch (Accuracy 92 %)▶️ Demo | Bunch of Activations
▶️ Demo | CNN
A recurrent neural network (RNN) is a class of artificial neural networks where connections between nodes form a directed graph along a temporal sequence. This allows it to exhibit temporal dynamic behavior.
-
📗 Theory | RNN - theory and explanation
-
▶️ Demo | RNN - Vanilla RNN for Single-Batch from scratch -
▶️ Demo | RNN - Vanilla RNN for Multi-Batch from scratch -
📗 Theory | RNN - Derivation of Back Propagation through Time(BPTT).
- 📗 Math | Newton's Raphson Method - Theory
▶️ Demo | Newton's Raphson Method - Implementation with ROC and AUC Curve
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
▶️ Demo
Make sure that you have Python installed on your machine.
You might want to use venv standard Python library
to create virtual environments and have Python, pip
and all dependent packages to be installed and
served from the local project directory to avoid messing with system-wide packages and their
versions.
Install all dependencies that are required for the project by running:
The list of datasets that are being used for Jupyter Notebook demos may be found in DataSet Folder.