项目作者: rezacharek

项目描述 :
Machine Learning models implemented as a personal project with visualization to aid understanding.
高级语言: Python
项目地址: git://github.com/rezacharek/MachineLearningAlgorithms.git
创建时间: 2020-10-15T13:23:31Z
项目社区:https://github.com/rezacharek/MachineLearningAlgorithms

开源协议:

下载


Machine Learning Algorithms

The repository is a personal project of implementing all of the machine learning algorithms that I learnt from scratch. I do so as to get a better intuitive understanding of the different algorithms, how they work, their complexity and their limits.

So far, the algorithms that were implemented are: Perceptron, Adaline, and currently working on K-NN.

Usage of Models

A simple usage example for Perceptron is:

  1. from perceptron import Perceptron
  2. my_model = Perceptron()
  3. my_model.train(X_train, Y_train)
  4. my_model.predict(X_test)

A simple usage example for Adaline is:

  1. from adline import Adaline
  2. my_model = Adaline()
  3. my_model.train(X_train, Y_train)
  4. my_model.predict(X_test)

Usage of Visualisation

By executing:

  1. python3 perceptron_show_iris.py

One gets this image, showing that the algorithm well on the Iris dataset.

Test Image 1

Now one can interactively input points to test Perceptron. To do so, all you need it to:

  1. python3 perceptron_show_manual.py

And then click with the mouse on the plot. THe right mouse click will set the first class points and the left mouse click will set the second class. Once done, click on the “X” button. If the background becomes green then it means that the perceptron managed to separate the data, otherwise it was unsuccesful.

First_Manuel_Image

Second_Manuel_Image

Perceptron on MNIST

What really is of interest if the use of much more complex data like hand-written digits. Perceptron was used to separate the 1 and 8 digits, but could be used for other digits.
To excute it and see by yourself all you need is to ype:

  1. python3 perceptron_show_digits.py

Which gives us:

Alt Text