A python implementation of the build block of the Neural Network, The Perceptron
Project description
Python-Perceptron
An Basic implementation of the perceptron, the build block a neural net.
Usage
pip install PyPerceptron
Example
Here's how to instanitate the Perceptron
from Perceptron.perceptron import Perceptron
p = Perceptron(number_inputs, learning_rate, Activation_fn, Loss_fn)
from Perceptron.perceptron import Perceptron
from Perceptron.functions.activationFunctions.heaviside import Heaviside
from Perceptron.functions.lossFunctions.quadratic_loss import QuadraticLoss
dataset = [[2.7810836, 2.550537003, 0],
[1.465489372, 2.362125076, 0],
[3.396561688, 4.400293529, 0],
[1.38807019, 1.850220317, 0],
[3.06407232, 3.005305973, 0],
[7.627531214, 2.759262235, 1],
[5.332441248, 2.088626775, 1],
[6.922596716, 1.77106367, 1],
[8.675418651, -0.242068655, 1],
[7.673756466, 3.508563011, 1]]
p = Perceptron(2, 0.1, Heaviside(), QuadraticLoss()) # number of inputs, learning rate, activation function, loss funciton
p.train(dataset, 3, 30)
for d in dataset:
assert p.evaluate(d[0], d[1]) == d[2]
To find out more about the math behind the perceptron, check out the notebook with the fully explanation.
If you wanna see more about how to use the perceptron checkout the demos.
Author
Paolo D'Elia
Contributing
Feel free report issues and contribute to the project, making it better.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PyPerceptron-1.0.1.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for PyPerceptron-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8ebb29d8437c0794f04d216a9606edf3c413b9b760e0c180c5b8b9b356ed020 |
|
MD5 | d5e82b2c4b5c3ded785e9ff52365c2e5 |
|
BLAKE2b-256 | 621c71af145dda1d80506b06d3b018d89ec259269a15c11e26ee27a8e162b02b |