A Lame Neural Network Library
Project description
Deadrin
Deadrin is a simple neural network library that computes gradients without using backpropagation. It uses a brute-force method to estimate gradients by making tiny change to each weight and bias and observing the effect on the cost function. While this method works, it is highly inefficient for large networks and datasets.
The process is as follows:
- For each weight and bias in the network,
Deadrin
makes a tiny change to that parameter. - It then evaluates the cost function (which measures how well the network is performing) before and after the tiny change.
- The gradient is estimated by observing how the cost function changes due to this tiny change.
- This process is repeated for every weight and bias in the network.
- Once all gradients are computed,
Deadrin
uses gradient descent to update all the weights and biases, moving them in the direction that reduces the cost function.
Features
- Simple Dense layer implementation with various activation functions
- Brute-force gradient computation
- Supports mean squared error (MSE) and categorical cross-entropy loss functions
- Educational tool to understand basic neural network training concepts
Installation
pip install deadrin
Dependencies
Demo
import numpy as np
from deadrin import Dense, Network
# Create the network
model = Network([
Dense(no_of_neurons=3, input_size=2, activation='relu')
Dense(no_of_neurons=1, activation='sigmoid')
])
# Compile the network
model.compile(loss='mse', lr=0.01)
# Generate some dummy data
X_train = np.random.randn(100, 2)
y_train = np.random.randint(0, 2, (100, 1))
# Train the network
model.fit(X_train, y_train, epochs=1000)
# Make predictions
predictions = model.forward(X_train)
print(predictions)
Contributing
Contributions are most welcome! Please open an issue or submit a pull request on GitHub.
License
Deadrin is released under the MIT License.
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file deadrin-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: deadrin-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f94010d0012d2c475daabb52e3b8cd185d43f6053f65d2dfd80f888113e3f686 |
|
MD5 | ac25822457d8351f5e6ceb640d260f70 |
|
BLAKE2b-256 | 3a8db4ca71b4200663dc6361f1e7492162f20a0104cf6db3469828b9b6e86c88 |