Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Perceptron

Build Status Coverage Status

Perceptron learning algorithm implemented in Python.

perceptron

Getting Started

This project depends upon the popular numerical processing library NumPy for lightning-fast vector arithmetic, and other packages for unit testing.

Prerequisites

To install NumPy, it's recommended you use Python's offical package manager pip.

To ensure pip is installed on your machine, run the command:

$ pip --version

pip should come installed with Python depending upon your version.

For more details, see installation on pip's documentation.

Installing

It's recommended you use virtualenv to create isolated Python environments.

You can find details on virtualenv's documentation.

Once pip is installed, run:

$ pip install -r requirements.txt

This will install this project's dependencies on your machine.

How to Run

$ python main.py

Usage

API inspired by the popular machine learning library scikit-learn.

import numpy as np
from perceptron import Perceptron

# Training data for logical OR function
training_data = np.array([
    [0, 0, 0],
    [0, 1, 1],
    [1, 0, 1],
    [1, 1, 1]
])
design_matrix = training_data[:, :2]
target_values = training_data[:, -1]

perceptron = Perceptron(max_iter=100, learning_rate=0.2)
perceptron.fit(design_matrix, target_values)
predictions = perceptron.predict(design_matrix)
print(predictions)  # [0, 1, 1, 1]

About

Perceptron learning algorithm implemented in Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages