Skip to content

Machine Learning models implemented as a personal project with visualization to aid understanding.

Notifications You must be signed in to change notification settings

rezacharek/MachineLearningAlgorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

from perceptron import Perceptron

my_model = Perceptron()
my_model.train(X_train, Y_train)
my_model.predict(X_test)

A simple usage example for Adaline is:

from adline import Adaline

my_model = Adaline()
my_model.train(X_train, Y_train)
my_model.predict(X_test)

Usage of Visualisation

By executing:

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:

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:

python3 perceptron_show_digits.py

Which gives us:

Alt Text

Releases

No releases published

Packages

No packages published

Languages