All Projects → Nikeshbajaj → Machine_Learning_From_Scratch

Nikeshbajaj / Machine_Learning_From_Scratch

Licence: other
Machine Learning models from scratch with a better visualisation

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language
matlab
3953 projects

Projects that are alternatives of or similar to Machine Learning From Scratch

The Deep Learning With Keras Workshop
An Interactive Approach to Understanding Deep Learning with Keras
Stars: ✭ 34 (+126.67%)
Mutual labels:  classification, logistic-regression, decision-trees
Machine Learning With Python
Python code for common Machine Learning Algorithms
Stars: ✭ 3,334 (+22126.67%)
Mutual labels:  naive-bayes-classifier, logistic-regression, decision-trees
Statistical-Learning-using-R
This is a Statistical Learning application which will consist of various Machine Learning algorithms and their implementation in R done by me and their in depth interpretation.Documents and reports related to the below mentioned techniques can be found on my Rpubs profile.
Stars: ✭ 27 (+80%)
Mutual labels:  logistic-regression, regularization, decision-trees
supervised-machine-learning
This repo contains regression and classification projects. Examples: development of predictive models for comments on social media websites; building classifiers to predict outcomes in sports competitions; churn analysis; prediction of clicks on online ads; analysis of the opioids crisis and an analysis of retail store expansion strategies using…
Stars: ✭ 34 (+126.67%)
Mutual labels:  classification, logistic-regression, decision-trees
Fuku Ml
Simple machine learning library / 簡單易用的機器學習套件
Stars: ✭ 280 (+1766.67%)
Mutual labels:  classification, logistic-regression, decision-trees
Data Science Toolkit
Collection of stats, modeling, and data science tools in Python and R.
Stars: ✭ 169 (+1026.67%)
Mutual labels:  classification, logistic-regression
Fake news detection
Fake News Detection in Python
Stars: ✭ 194 (+1193.33%)
Mutual labels:  classification, logistic-regression
Orange3
🍊 📊 💡 Orange: Interactive data analysis
Stars: ✭ 3,152 (+20913.33%)
Mutual labels:  classification, decision-trees
STOCK-RETURN-PREDICTION-USING-KNN-SVM-GUASSIAN-PROCESS-ADABOOST-TREE-REGRESSION-AND-QDA
Forecast stock prices using machine learning approach. A time series analysis. Employ the Use of Predictive Modeling in Machine Learning to Forecast Stock Return. Approach Used by Hedge Funds to Select Tradeable Stocks
Stars: ✭ 94 (+526.67%)
Mutual labels:  logistic-regression, decision-tree
100 Days Of Ml Code
100 Days of ML Coding
Stars: ✭ 33,641 (+224173.33%)
Mutual labels:  naive-bayes-classifier, logistic-regression
Machine-Learning-Models
In This repository I made some simple to complex methods in machine learning. Here I try to build template style code.
Stars: ✭ 30 (+100%)
Mutual labels:  logistic-regression, decision-tree
Machine Learning With Python
Practice and tutorial-style notebooks covering wide variety of machine learning techniques
Stars: ✭ 2,197 (+14546.67%)
Mutual labels:  classification, decision-trees
Sporf
This is the implementation of Sparse Projection Oblique Randomer Forest
Stars: ✭ 70 (+366.67%)
Mutual labels:  classification, decision-trees
C4.5
A python implementation of C4.5 algorithm by R. Quinlan
Stars: ✭ 51 (+240%)
Mutual labels:  classification, decision-trees
scoruby
Ruby Scoring API for PMML
Stars: ✭ 69 (+360%)
Mutual labels:  classification, decision-tree
Data-Mining-and-Warehousing
Data Mining algorithms for IDMW632C course at IIIT Allahabad, 6th semester
Stars: ✭ 19 (+26.67%)
Mutual labels:  naive-bayes-classifier, decision-tree
click-through-rate-prediction
📈 Click-Through Rate Prediction using Logistic Regression and Tree Algorithms
Stars: ✭ 60 (+300%)
Mutual labels:  logistic-regression, decision-trees
Jsmlt
🏭 JavaScript Machine Learning Toolkit
Stars: ✭ 22 (+46.67%)
Mutual labels:  classification, logistic-regression
Awesome Fraud Detection Papers
A curated list of data mining papers about fraud detection.
Stars: ✭ 843 (+5520%)
Mutual labels:  classification, logistic-regression
Quick-Data-Science-Experiments-2017
Quick-Data-Science-Experiments
Stars: ✭ 19 (+26.67%)
Mutual labels:  logistic-regression, decision-tree

Machine Learning From Scratch

DOI DOI

HitCount Percentage of issues still open GitHub commit activity License: MIT GitHub release

GitHub stars Ask Me Anything !

With good visualisations

Without using any ML libraries

Now available in spkit library

Installation

Install spkit pip install spkit

from spkit.ml import LR, NaiveBayes, ClassificationTree, RegressionTree

(Few visualisations are limited to 2D data only, others can be used for any dimenntions)


View Github page


Table of contents


1. Logistic Regression

Code ans examples are here

Download (right click and 'save link as'):

#from LogisticRegression import LR # given code

##NOW USE spkit library (pip intall spkit)
from spkit.ml import LR
clf = LR(X,y,alpha=0.003,polyfit=True,degree=5,lambd=2)
fig=plt.figure(figsize=(8,4))
gs=GridSpec(1,2)
ax1=fig.add_subplot(gs[0,0])
ax2=fig.add_subplot(gs[0,1])

for i in range(100):
    Clf.fit(X,y,itr=10)
    ax1.clear()
    Clf.Bplot(ax1,hardbound=False)
    ax2.clear()
    Clf.LCurvePlot(ax2)
    fig.canvas.draw()
    plt.pause(0.001)
    
clf.predict(X)
W,b =clf.getWeight()


2. Deep Neural Network - Deeplearning

Code and examples are here

Full detail of implementation and use of code is describe here

          

Download (right click and 'save link as'):


3. Neural Network (simple structure-fully connected) with any number of layers (Matlab/Octave)

Code and examples here

Network can be created and trained as for example

W= NeuralNet(X,y,HL,Iterations,alpha,verbose);

% For 2 hidden layers with 5 and 3 neurons, 500 iteration and 0.1 alpha(learning rate)
% input and output layers are chosen according to data X,y provided

W= NeuralNet(X,y,[5,3],500,0.1,1); 

% for 8 hidden layers
W= NeuralNet(X,y,[15,10,10,10,5,5,5,3],100,0.1,1);

returns weights W of each layer


4. Kernel Learning & regularization

Methods

Kernal Learning

(Linear, Polynomial, Gaussian)

  • Linear equation1
  • Polynomial equation2
  • Gaussian (RBF) equation3

Code and examples with GUI are given here

Installation::

pip install regml

Execute

import regml
regml.GUI()

Download (right click and 'save link as'):


5 Naive Bayes

Probabilistic model

Classifier based on Bayes rule:

Example with jupyter notebook here and Repository

Notebook include example of Iris data, Breast Cancer and Digit classification (MNIST)

Notebook

                     Class file

Download (right click and 'save link as'):

here is code snippet

import numpy as np
import matplotlib.pyplot as plt

# For dataset
from sklearn import datasets
from sklearn.model_selection import train_test_split

# Library provided
#from probabilistic import NaiveBayes (NO NEED OF THIS)

##NOW USE spkit library (pip intall spkit)
from spkit.ml import NaiveBayes

data = datasets.load_iris()
X = data.data
y = data.target

Xt,Xs,yt,ys = train_test_split(X,y,test_size=0.3)

print(Xt.shape,yt.shape,Xs.shape,ys.shape)

# Fitting model (estimating the parameters)
clf = NaiveBayes()
clf.fit(Xt,yt)

# Prediction
ytp = clf.predict(Xt)
ysp = clf.predict(Xs)

print('Training Accuracy : ',np.mean(ytp==yt))
print('Testing  Accuracy : ',np.mean(ysp==ys))

print(clf.parameters)

# Visualization
fig = plt.figure(figsize=(12,10))
clf.VizPx()


6 Decision Trees

Installation (Now in spkit library)

pip install spkit

Classification and Regression Tree

Requirement: All you need for this is Numpy and matplotlib** (Of course Python >=3.0)

See the examples in Jupyter-Notebook or Repository for more details

Notebook

          

Download (right click and 'save link as'):

Import

import numpy as np
import matplotlib.pyplot as plt

#(NO NEED OF THIS)
#Download trees.py and keep in current directory or give a path (if you know how to)
#from trees import ClassificationTree, RegressionTree

##NOW USE spkit library (pip intall spkit)
from spkit.ml import ClassificationTree, RegressionTree

# For examples
from sklearn import datasets
from sklearn.model_selection import train_test_split

Iris Data

data = datasets.load_iris()
X = data.data
y = data.target

feature_names = data.feature_names #Optional
Xt,Xs, yt, ys = train_test_split(X,y,test_size=0.3)

Initiate the classifier and train it

clf = ClassificationTree()

# verbose 0 for no progress, 1 for short and 2 for detailed.
# feature_names is you know, else leave it or set it to None

clf.fit(Xt,yt,verbose=2,feature_names=feature_names)  

Plot the decision tree

# Plot Tree that has been learned
plt.figure(figsize=(15,8))
clf.plotTree(show=True)

Visualizing the tree building while training

Classification: Iris Data, Breast cancer Data Regression::Bostan House price Data

Visualization of decision tree after fitting a model

Option to show colored branch: Blue for True and Red for False Or just show all branches as blue with direction to indicate True and False branch

Iris data: Decesion Tree | Cancer data: Decesion Tree

|

Boston data: Decesion Tree

Visualizing the progress of tree building while training

Tree building for Cancer Data (Classification)

Detailed view

Short view

Follow @nikeshbajaj

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].