Skip to main content

A small package for perceptron

Project description

Perceptron Python Package

References -

Perceptron from Scratch 🚀

This project is an end-to-end implementation of the Perceptron algorithm from scratch using Python and NumPy — without using any high-level ML libraries. It includes training logic, prediction, model serialization, automated testing, CI/CD integration via GitHub Actions, and deployment as a PyPI package.


📦 PyPI Package

Install it using pip:

pip install perceptron-scratch

# Project Structure
perceptron-scratch/
│
├── perceptron/               # Core Perceptron implementation   ├── __init__.py
│   ├── perceptron.py
│   └── utils.py
│
├── tests/                    # Unit tests   └── test_perceptron.py
│
├── .github/workflows/        # GitHub Actions CI/CD pipeline   └── python-publish.yml
│
├── setup.py                  # Packaging config
├── pyproject.toml            # Build system
├── README.md
└── LICENSE

What is a Perceptron?
A Perceptron is the simplest form of a neural network used for binary classification. It computes a weighted sum of the inputs and passes it through an activation function (step function in this case).

✨ Features
✅ Trainable Perceptron model from scratch

✅ Supports binary classification

✅ Uses NumPy for matrix operations

✅ CLI-compatible structure

✅ Model saving & loading using joblib

✅ Unit tests included

✅ GitHub Actions for CI/CD

✅ Packaged and deployed to PyPI

# How to Use It
```bash
from perceptron.perceptron import Perceptron
from perceptron.utils import prepare_data
import pandas as pd

# Sample Data - AND Gate
data = {
    "x1": [0, 0, 1, 1],
    "x2": [0, 1, 0, 1],
    "y":  [0, 0, 0, 1]
}
df = pd.DataFrame(data)
X, y = prepare_data(df, target_column="y")

# Train the Model
model = Perceptron(eta=0.1, epochs=10)
model.fit(X, y)
model.total_loss()

# Save and Load
model.save("and.model")
reloaded_model = model.load("model/and.model")

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

perceptron_prasath-0.0.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

perceptron_prasath-0.0.3-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file perceptron_prasath-0.0.3.tar.gz.

File metadata

  • Download URL: perceptron_prasath-0.0.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for perceptron_prasath-0.0.3.tar.gz
Algorithm Hash digest
SHA256 42d14af0702f13c112266668db3daf0c44a0d9d5cb2c27430098385da606e2b5
MD5 aaa6bef7e5458e855c08c04cfe7d5d49
BLAKE2b-256 d01e4ca38abd58ef190f3797fb6ecafa4fe54d9f6e32157bb75219cb0adba58e

See more details on using hashes here.

File details

Details for the file perceptron_prasath-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for perceptron_prasath-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3588e8c01bf7307702b4a2bb943aba5b67b098072ac064d8d0e61f6755de2192
MD5 eeab67214ba81e790e6b556158c3578b
BLAKE2b-256 60d19abfb90ad41b5fa7ae8e26e6334415df6b9b5f137be213fac05cb9cf6129

See more details on using hashes here.

Supported by

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