Skip to main content

A python implementation of the build block of the Neural Network, The Perceptron

Project description

Python-Perceptron

language license

An Basic implementation of the perceptron, the build block a neural net.

perceptron

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


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)

Uploaded Source

Built Distribution

PyPerceptron-1.0.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page