Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mihneamanolache/python-perceptron
Frank Rosenblatt's perceptron algorithm implemented in Python.
https://github.com/mihneamanolache/python-perceptron
Last synced: 9 days ago
JSON representation
Frank Rosenblatt's perceptron algorithm implemented in Python.
- Host: GitHub
- URL: https://github.com/mihneamanolache/python-perceptron
- Owner: mihneamanolache
- Created: 2022-12-20T09:45:53.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-30T15:50:53.000Z (almost 2 years ago)
- Last Synced: 2023-11-26T10:33:23.717Z (12 months ago)
- Language: Python
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python Perceptron
A perceptron is a type of artificial neural network that is used for binary classification. It consists of a single layer of perceptrons, which are simple processing units that take in input from multiple sources, combine it with a set of weights, and produce a single output. The output is a binary value (i.e., 0 or 1) that represents the class to which the input belongs. The perceptrons in a single layer are connected to each other and to the input sources.
The weights of the connections between the perceptrons and the input sources are adjusted during training, so that the perceptron can learn to correctly classify the input data. The perceptron algorithm is a linear classifier, which means that it is only able to classify linearly separable data. However, it can be extended to multi-layer perceptrons, which are able to classify non-linearly separable data.
The original paper written by Frank Rosenblatt ia available [here](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=65a83117cbcc4e6eb7c6ac5be8e61195dc84b9fc).
## Prerequisites
This project is implemented with Python 3 and the dependencies found in `requirements.txt`. The level of Python knowledge required is intermediate, yet I did my best to keep the syntaax as simple as possible.## Running the Perceptron
The script consists of three classes:
- a Generator that generates trainig material based on the fonts available on your system
- a Processor that transformes images into arrays
- a Perceptron that predicts results upon trainingThe commands you can use to generate a new learning set are:
```py
# Generate new images
Generator().generate_training_list()# Generate training set
TRAINING_SET_A = [Processor().get_simplified_array(Processor().get_pixels_array(Processor().read_image(path=f'/{i}'), , )) for i in os.listdir('')]
```The command to Process a image is:
```py
Processor().get_simplified_array(Processor().get_pixels_array(Processor().read_image(path=f''), , ))
```The commands to train and predict are:
```py
PERCEPTRON = Perceptron(letter=)
PERCEPTRON.train()
PERCEPTRON.predict(Processor().get_simplified_array(Processor().get_pixels_array(Processor().read_image(path=f''), , )))
```This project is authored by [***Mihnea Manolache***](https://github.com/mihneamanolache) and guided by [***Conf. univ. dr. Popescu-Bodorin Nicolaie***](https://www.linkedin.com/in/bodorin/).