Code Monkey home page Code Monkey logo

python-machine-learning-models's Introduction

Python-Machine-Learning-Models

Simple Python implementations of a selection of the most commonly (and some less so) used machine learning algorithms. Studying and implementing these models will help with the understanding of their workings, unlike the black box nature of the models found in common python packages.

"Best" models (most well tested):

  1. GAN
  2. Clustering / K means and GMM
  3. RBM

In Development

  • A simple feed-forward neural network
    • Loss calculations incomplete
  • A simple convolutional neural network
  • Support vector machine
  • Support vector Regression
  • PCA
  • LDA
  • PPCA

DecisionTree

A classification staple. The tree object itself is found in tree.py, however all training and tree creation is carried out in decision_tree_learning in decisionTree.py. This functions uses the ID3 algorithm to recursively build the tree. The tree takes in a binary target vector, so for use cases where the data can be multi-valued, a function for allow one-v-rest classification has been created in decisionTree.py

TODO

  • Create a random forest classifier

Clustering

Currently two clustering algorithms - K-means, and Gaussian Mixture Model (GMM). K-means assigns hard labels to each data point; GMM is a generalisation of K-means, in which a data point is assigned a probability of being in each of the K clusters.

RBM

Not popular today, but a great introduction to generative models

TODO

  • Test
  • Allow classification as well as generation
  • Build on the RBM class to create a more powerful Deep Belief Net

Regression

A couple of common linear regression techniques.

  • Maximum A Posteriori
  • Bayesian Regression

Gaussian Process

A powerful regression technique. Object for full GP, as well as a distributed experts model. The distributed model allows for faster training, and training time goes from O(N^3) to O(M D^3), where M is the number of experts, N is the total data points, and D is number of data points per expert.

Run test_gp.py to see a plot of (unoptimized) matern and rbf kernel GPs.

TODO

  • Fix optimize to avoid underfitting
  • Fix problem of numerical overflow in some (most) test data
  • Add periodic kernel - make gp class more robust to varying hyperparameter names (i.e. don't refer to names)
  • Clean code for distributedGP (only one "predict" function)
  • Bayesian optimisation

GAN

Generative model, currently utilises the MNIST dataset to generate handwritten digits.

TODO

  • Build GAN on a faces dataset

Hidden Markov Model

A model for finding the latent distributions when consecutive data points can be generated from different distributions. The HMM object can work with gaussian (model = 'gauss') or multinomial (model = 'multinomial') data.

TODO

  • Test
  • Add comments to remaining functions

python-machine-learning-models's People

Contributors

ttitcombe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

python-machine-learning-models's Issues

Redo RBM functions

code in "train" doing the same as "h".
parameter names e.g. inp, hid, hidden, are confusing.

FID giving NaN

When calculating FID, no square root of matrix as it is singular.

RBM not training correctly

Image displayed during training immediately all white, with no change.

Mean weight value drops to negative.

May be due to learning rate, or bug in training code.

category

hi, I want to know is the tree model can deal with category ,like male/female or S/C .... thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.