Skip to main content

MLP Neural Network

MLP Neural Network is a lightweight Python library for building and training Multi-Layer Perceptron (MLP) models. This repository provides a simple yet powerful framework for experimenting with neural networks, along with an example program and dataset to help you get started quickly.

Features

  • Simple API: Quickly build and train neural network models with a few lines of code.
  • Customizable Architecture: Easily configure the number of layers, neurons per layer, activation functions, learning rates, epochs, batch size and threshold.
  • Example Program: The included "test.py" script demonstrates how to integrate and use the library in a real-world scenario.
  • Sample Dataset: Comes with an iris.csv file containing the famous Iris dataset, ideal for testing and learning.

Getting Started

Requirements

  • Python 3.x is required.
  • NumPy library is required.
  • Pandas library is required.
  • Matplotlib library is required.
  • Json (built-in) library is required.

Install NumPy python library by using the below.

pip install numpy
pip install pandas
pip install matplotlib

Installation

Clone the repository to your local machine:

git clone https://github.com/ThePhantom2307/MLP-Neural-Network.git
cd MLP-Neural-Network

Or you can use the built-in function pip

pip install NeuralNetworkMLP

Running the Example

The repository includes an example script (test.py) that shows how to use the library. The script loads the provided iris.csv dataset, builds an MLP model, trains it, and evaluates its performance. To run the example, simply execute:

python test.py

Usage

You can incorporate the MLP Neural Network library into your own projects. Below is a short example to illustrate how to use the library:

import NeuralNetworkMLP as nn
import numpy as np

# Load or create the datasets
xTrain = np.array([[0, 1],
                   [1, 0],
                   [1, 1],
                   [0, 0]])

yTrain = np.array([[1], [1], [0], [0]])

xTest = np.array([[1, 0]])

# Define your network architecture: for example, input layer of size 2, one hidden layer with 10 neurons, and output layer of size 1.
neuralNetwork = nn.NeuralNetwork(
    inputLayerNeurons=2,
    hiddenLayersNeurons=[10],
    outputLayerNeurons=1,
    activationFunctions=[nn.RELU, nn.SIGMOID]
)

# Train the model on your training data
neuralNetwork.train(xTrain, yTrain)

# Predict on new data
predictions = neuralNetwork.predict(xTest)

# Save the model
neuralNetwork.saveModel("NeuralNetworkModel.json")

# Load the model
neuralNetwork.loadModel("NeuralNetworkModel.json")

For more detailed usage, refer to the "test.py" file, which provides a complete example.

Contributing

Contributions, suggestions, and bug reports are welcome! If you’d like to contribute, please fork the repository and create a pull request. Alternatively, feel free to open an issue to discuss improvements.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for NeuralNetworkMLP 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for NeuralNetworkMLP 1.1.2
File Size Uploaded
neuralnetworkmlp-1.1.2.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for NeuralNetworkMLP 1.1.2
File Interpreter ABI Platform
neuralnetworkmlp-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.2 kB

Release files / neuralnetworkmlp-1.1.2.tar.gz

Download URL neuralnetworkmlp-1.1.2.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c2c0b676e7ea00dbbb60022e479c560cacc87dda03eeaf2a6a90669a4680bc21
BLAKE2b-256 checksum
How to use checksums
b00c9d31eaf7347a13e10885fb266ab548bc1f9827c1af74fbd2000cbcc22e2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / neuralnetworkmlp-1.1.2-py3-none-any.whl

Download URL neuralnetworkmlp-1.1.2-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d47003b6ac27630be22bf7b1de0e0f9f25700ba71ae68366eec9f88406dde739
BLAKE2b-256 checksum
How to use checksums
19f3f80f5573c0d4561133efcb6e9ca5e3d07711bbcbfbca7eab7dfe5ecd1111
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page