Skip to content
Neural Network lib in Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Neural Network lib in Python - Main Neural Network Class - Data visualization Class - Dataset Class

Graphics - Pygame Graphics Class - QT Graphics Class

Install Dependencies

pip install -r requirements.txt

Example Code

from NN import *
from Data import *

data = Data()
data.generateXORData(1000, 0.2)  #generate XOR dataset with 1000 points

testData = Data()
testData.generateXORData(50, 0.2) #generate another XOR dataset with 50 points, this will be used for validation

nn = NN(2,4,3,1) #2 input neurons, 4 neurons in first hidden layer, 3 in second hidden layer and 1 in output layer
nn.activationFunction = "sigmoid" #use the sigmoid function as the activation function
nn.learningRate = 0.03
for i in range(1000): #500 epochs of training
    if(i%10 == 0): #print error rate every 10 epochs
        error = nn.evaluate(testData)
        print("epoch %d: %f"%(i,error[0]))
    nn.minibatch(data,10) #train model with minibatches of 10


You can’t perform that action at this time.