Feed Forward Neural Networks
Project description
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
Usage
>>> from Model import NeuralNetwork
Create 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, graph=True)
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()
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
Close
Hashes for neuralnetworks-shine7-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d24b03c1e2f6182a5e7aaac4f3f71c1cc78a81cf24f8ebf9ba8c7398aa6e80a6 |
|
MD5 | 159f9a7eec295318ef28e3dda295b87b |
|
BLAKE2b-256 | 481abce8e597e91a679491c8468ed0e3524d7021098b67f260114186d2d2a58d |
Close
Hashes for neuralnetworks_shine7-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8449bd09dd405f9eef086f7b9d6403df7182e3d7750db9059190bc386873854f |
|
MD5 | 5adc430010bded0efa2f3da4854713ae |
|
BLAKE2b-256 | 9e958a675da72ce008230b9f7b23ad04003ed5e9a12ab7199c4e0a9fe4def4e2 |