Neural Network lib for ncxlib
Project description
NCxLib: A Lightweight Neural Network Library in Python
ncxlib is a lightweight and easy-to-use neural network library built in Python. It provides a simple API for constructing and training neural networks, along with tools for data preprocessing and generation.
Features
- Modular Design: Easily build custom neural networks by combining different layers, activation functions, and loss functions.
- Data Handling: Includes data loaders for CSV and image data, with preprocessing capabilities like scaling and grayscaling.
- Training and Evaluation: Train your networks with various optimization algorithms and evaluate their performance.
- Extensible: Add your own custom layers, activations, and loss functions to expand the library's functionality.
Installation
pip install ncxlib
Getting Started
Here's a quick example of how to use ncxlib to create and train a simple neural network:
# External imporst
import numpy as np
# Util imports
from ncxlib import generators, dataloaders
from ncxlib.util import train_test_split
# Neural network imports
from ncxlib.neuralnetwork import optimizers, losses
from ncxlib.preprocessing import MinMaxScaler
from ncxlib.neuralnetwork import NeuralNetwork, FullyConnectedLayer
from ncxlib.neuralnetwork import activations
from ncxlib.neuralnetwork.initializers import HeNormal, Zero
# ------- Generate some data using generators -------
generators.generate_training_data(to_csv=True)
# ------- Load data from generated csv and split it into train and test -------
loader = dataloaders.CSVDataLoader("training_data.csv")
X, y = loader.get_data()
X_train, X_test, y_train, y_test = train_test_split(X, y)
# ------- Configure model layers -------
model = NeuralNetwork([
FullyConnectedLayer(
n_neurons=3,
activation=activations.ReLU,
optimizer=optimizers.Adam(beta_1=0.9, beta_2=0.999, epsilon=1e-07),
name="first_hidden",
weights_initializer=HeNormal(),
bias_initializer=Zero()
),
FullyConnectedLayer(
n_neurons=5,
activation=activations.ReLU,
optimizer=optimizers.SGDMomentum(momentum = 0.9),
name="second_hidden",
initializer=HeNormal(),
),
FullyConnectedLayer(
n_neurons=2,
activation=activations.Sigmoid,
optimizer=optimizers.RMSProp(decay_rate = 0.8)
)
],
loss_fn=losses.BinaryCrossEntropy
)
# ------- Train model and evaluate accuracy -------
model.train(X_train, y_train, epochs=20, learning_rate=0.01)
model.evaluate(X_test, y_test)
Contributing
Thank you for your interest in contributing to the ncxlib library for Neural Network development. We are thrilled you are considering contributing to our project.
How to Contribute
- Take a look at the list of immediate contributions needed listed under the issues
- Look for areas around the repository with comments marked #TODO. If you find one, feel free to create an issue and get approval before starting the work.
- Any suggestions or feedback - please create an issue.
- Open a Pull Request with your issue and the team will review and approve/deny or provide comments on the PR.
License
This project is licensed 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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ncxlib-0.3.3.tar.gz.
File metadata
- Download URL: ncxlib-0.3.3.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.7 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cba7b0bd1232c5827878fc6d66d6a532e6176219dd7501a58a5c67084987da8e
|
|
| MD5 |
3b4cfdd75e970c20817e4917e598f4e5
|
|
| BLAKE2b-256 |
0109d3a6e49127b15e907c8b5a5f561c3e41fcd5916eb9fae7c5b739c00fb9d0
|
File details
Details for the file ncxlib-0.3.3-py3-none-any.whl.
File metadata
- Download URL: ncxlib-0.3.3-py3-none-any.whl
- Upload date:
- Size: 39.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.7 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
339639b4976172baf1bc32ad00c77061e82682fbcd333f2b54a282310527c34d
|
|
| MD5 |
4caf972bed4b18f6db3848830319c92a
|
|
| BLAKE2b-256 |
04b8ad82667bcc962011da8da2f3533856bb6c2b7e5513114d50434cfe9a23ea
|