PyZapo
PyZapo is a lightweight, modular, object-oriented deep learning framework built completely from scratch using only NumPy. It mimics the intuitive style of PyTorch, making it perfect for understanding modern neural network mechanics under the hood.
🚀 Features
- Computer Vision & CNN Support (New in 1.2.0): Introduces a native Conv2D layer built completely from scratch using pure NumPy vector operations. Supports customizable input/output channels, kernel sizes, strides, and padding along with integrated backpropagation.
- Advanced Activations: Fully supports LeakyReLU with configurable alpha parameters to effectively prevent the "dying ReLU" problem and stabilize deep neural architectures (like GANs).
- Custom Autograd & Tensor Engine: Supports computational graphs with automated backward passes for seamless gradient tracking via Tensor and evaluation controls via no_grad.
- Object-Oriented Architecture: Build clean pipelines using Sequential blocks and custom Module classes.
- Robust Built-in Optimization: Layers come equipped with an integrated Adam optimizer right out of the box.
- Gradient Saturation Protection: Custom math safety controls (including vector clipping) in activations like Sigmoid to prevent gradient death.
- Advanced Loss Functions: Supports MSELoss, BCELoss (with automatic stabilization), and full multi-class CrossEntropyLoss (Fused Softmax + CE).
📦 Installation
Install the package directly from PyPI:
bash
pip install pyzapo
Используйте код с осторожностью.
🛠️ Quick Start: Multi-Class Digit Classification (0-9)
Here is how easily you can build, train, and test a deep neural network using PyZapo 1.2.0 to classify inputs into 10 different categories (perfectly suited for datasets like MNIST):
python
import numpy as np import pyzapo as pz
1. Generate synthetic dataset (e.g., 5 flattened 28x28 images)
X = np.random.rand(5, 784)
One-hot encoded labels for 10 distinct classes (digits 0-9)
y = np.eye(10)[:5]
2. Define deep network architecture with LeakyReLU (Clean OOP Style without .forward())
model = pz.Sequential([ pz.Linear(784, 32), pz.LeakyReLU(alpha=0.2), # Advanced activation handling negative gradients pz.Linear(32, 10) ])
criterion = pz.CrossEntropyLoss()
3. Training Loop with automated backpropagation and Adam steps
print('Training the model...') for epoch in range(1501): logits = model(X) # Clean call syntax loss = criterion(logits, y) # Fused Softmax + CrossEntropy
loss_grad = criterion.backward()
model.backward(loss_grad)
model.step(lr=0.01)
if epoch % 300 == 0:
print(f'Epoch {epoch:4d} | Loss: {loss:.6f}')
4. Inference and Evaluation using no_grad context
with pz.no_grad(): test_logits = model(X)
shift_logits = test_logits - np.max(test_logits, axis=-1, keepdims=True) probs = np.exp(shift_logits) / np.sum(np.exp(shift_logits), axis=-1, keepdims=True)
predictions = np.argmax(probs, axis=-1) true_classes = np.argmax(y, axis=-1)
print(f'True Labels: {true_classes.tolist()}') print(f'Predictions: {predictions.tolist()}')
Metadata
Release files for pyzapo 1.2.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyzapo-1.2.8.tar.gz | 8.1 kB | Without provenance | Details for pyzapo-1.2.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyzapo-1.2.8-py3-none-any.whl | Python 3 | none | any | Details for pyzapo-1.2.8-py3-none-any.whl |
Total release size: 15.1 kB
Release files / pyzapo-1.2.8.tar.gz
| Download URL | pyzapo-1.2.8.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d21b01e90699861a24bd143b390de9d45e0f72ee317facf2c5501817e8bc7235
|
|
BLAKE2b-256 checksum How to use checksums |
04bc3ae29305dcc5a8b675baa21c32af57e106f0e3bb54198b16eff8cfd5b0f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Release files / pyzapo-1.2.8-py3-none-any.whl
| Download URL | pyzapo-1.2.8-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
677387f64fe90b37c59b470cfdc3bc303d8ec6d1f99eced9e1ed32ada3197cb1
|
|
BLAKE2b-256 checksum How to use checksums |
dfb5369d351eae15e75eaae0cfc0c0f66de568c062db6f7d59130ceaab3b404a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Security for pyzapo 1.2.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.