Feed Forward Neural Networks using NumPy
This library is a modification of my previous one. Click Here to check my previous library.
Installation
$ [sudo] pip3 install neuralnetworks-shine7
Development Installation
$ git clone https://github.com/Subhash3/Neural_Net_Using_NumPy.git
Usage
>>> from Model import NeuralNetwork
Creating a Neural Network
inputs = 2
outputs = 1
network = NeuralNetwork(inputs, outputs)
# Add 2 hidden layers with 16 neurons each and activation function 'tanh'
network.addLayer(16, activation_function="tanh")
network.addLayer(16, activation_function="tanh")
# Finish the neural network by adding the output layer with sigmoid activation function.
network.compile(activation_function="sigmoid")
Building a dataset
The package contains a Dataset class to create a dataset.
>>> from Dataset import Dataset
Make sure you have inputs and target values in seperate files in csv format.
input_file = "inputs.csv"
target_file = "targets.csv"
# Create a dataset object with the same inputs and outputs defined for the network.
datasetCreator = Dataset(inputs, outputs)
datasetCreator.makeDataset(input_file, target_file)
data, size = datasetCreator.getRawData()
Training The network
The library provides a Train function which accepts the dataset, dataset size, and two optional parameters epochs, and logging.
def Train(dataset, size, epochs=5000, logging=True) :
....
....
For Eg: If you want to train your network for 1000 epochs.
>>> network.Train(data, size, epochs=1000)
Notice that I didn't change the value of log_outputs as I want the output to printed for each epoch.
Debugging
Plot a nice epoch vs error graph
>>> network.epoch_vs_error()
Know how well the model performed.
>>> network.evaluate()
Metadata
Release files for neuralnetworks-shine7 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| neuralnetworks-shine7-0.0.4.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| neuralnetworks_shine7-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.5 kB
Release files / neuralnetworks-shine7-0.0.4.tar.gz
| Download URL | neuralnetworks-shine7-0.0.4.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d71cade7bda89a1b8e17be0dfb66d6c3a7a0b4b346fe04fe06a39a37dea6b6bd
|
|
BLAKE2b-256 checksum How to use checksums |
a779c82bf2c6466c6d964bea117442f860f41ba245cbe5ee25aae3b58628ff37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
|
Release files / neuralnetworks_shine7-0.0.4-py3-none-any.whl
| Download URL | neuralnetworks_shine7-0.0.4-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c904ff3f9112797966eaf70b95847e21c4a9286e21ea203199364f6f8740976
|
|
BLAKE2b-256 checksum How to use checksums |
8e8ada9dcd891b57804f7ececc25babbd9f7a9eb1bf915d7e51102409a49d330
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
|