Implementation of a single-layer perceptron in x86 assembly.
I was inspired by the very simple perceptron algorithm described in Veritasium's video on analog computers. I also wanted another assembly challenge and I've never written any x86 floating point code before.
This perceptron is a classifier to distinguish between circles and rectangles.
Model trained with 500 samples and 3000 training rounds resulted in 90% success rate.
See model.ppm for the raw image file.
I also generated a video of the training process docs/training.mp4
A perceptron is a simple mathematical model attempting to mimic how a biological neuron works. A neuron fires or activates when the dot product of inputs and weights is larger than the specified bias.
Frank Rosenblatt built the first implementation of a perceptron as a specialized machine in 1958. Read more about the history of the perceptron here.
A single-layer perceptron is the simplest neural network you can make.
- dependencies:
apt install nasm ffmpeg imagemagick
- build:
make
- build and run:
make run
- build assets:
make assets
- x86 64-bit Linux System Calls
- Feedforward Neural Network
- Perceptron Wikipedia
- Compiler Explorer
- Veritasium - Future Computers Will Be Radically Different
- Linear Congruential Generator (Easy random numbers in ASM)
- PPM files
- Floating point
- https://en.wikibooks.org/wiki/X86_Assembly/Floating_Point
- http://www.ray.masmcode.com/tutorial/index.html
- IEEE-754 Floating Point Converter
- https://www.cs.cornell.edu/~tomf/notes/cps104/floating.html
- http://mathcenter.oxford.emory.edu/site/cs170/ieee754/
- The Art of Assembly Language. Randall Hyde - Chapter 14