22 lines
620 B
Markdown
22 lines
620 B
Markdown
# Perceptron
|
|
|
|
This is a simple perceptron, with data to train it on. It is from [this article](https://sharpsight.ai/blog/python-perceptron-from-scratch/). I copied the code for the perceptron class from the article and added the comments, as I read the article, to understand how it works.
|
|
|
|
I also added the part where we use to see if 2 numbers are > 2 when added. It works !
|
|
|
|
```
|
|
Model initialized, starting to train with 1000 iterations on 10 data samples
|
|
Features (x) : [[0 0]
|
|
[0 1]
|
|
[1 0]
|
|
[1 1]
|
|
[2 2]
|
|
[2 0]
|
|
[0 2]
|
|
[3 1]
|
|
[1 3]
|
|
[3 3]]
|
|
Truths (y): [0 0 0 0 1 0 0 1 1 1]
|
|
Predictions : [0 0 0 0 1 0 0 1 1 1]
|
|
```
|