vivekkr12 / machine-learning-algorithms

Implementation of common machine learning algorithms in Python from scratch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Machine Learning Algorithms

Build Status Coverage Status NB Viewer

Implementation of common machine learning algorithms from scratch in Python

Algorithm Math Implementation Demo
Ridge Regression Theory and Derivation Python Implementation Demo
Regularised Logistic Regression Theory and Derivation Python Implementation Demo
Lasso Regression Theory and Derivation Python Implementation Demo
K Means Theory and Algorithm Python Implementation Demo
Principal Component Analysis Theory and Algorithm Python Implementation Demo

Dependencies

The package depends only on numpy. Running the demos will require additional packages such as jupyter, pandas and sklearn.

Running the Demos

The demos are in ipynb notebooks. Make sure you have the dependencies - pandas and sklearn installed in your environment. Then from the root of the project start the ipynb server by running $ jupyter notebook and navigate to the directory demo.

Installation

To install the package locally, run the following from the root of the project

$ python setup.py install

To make a pip installable tar archive, run

$ python setup.py sdist

The tar file would be generated inside dist folder. The package can be installed using the tar archive by running

$ pip install pymlalgo-0.0.1.tar.gz

For details on how to install packages from tar archive, refer to this link on StackOverflow

Usage

Once you have the package installed, import the module, initialize the class with data and hyper parameters and then train the model. For example to use KMeans:

from pymlalgo.clustering.k_means import KMeans

model = KMeans(x, k, max_iter=200)
model.train()

# get assigned cluster
model.labels

About

Implementation of common machine learning algorithms in Python from scratch


Languages

Language:Python 60.0%Language:Jupyter Notebook 40.0%