Package: noelnetwork
Neural Network CreatorCreate and generate Neural Networks without using heavy modules like KerasTable of contentsGeneral infoScreenshotsSetupTutorialStatusExample Code>>>fromneuralimportNeural>>>nodes=[[0,0],# 2 Input Neurons>>>[0,0,0,0,0,0],# 6 Hidden Neurons (Hidden Layer #1)>>>[0,0,0,0,0,0],# 6 Hidden Neurons (Hidden Layer #2)>>>[0,0,0,0]]# 4 Output Neurons>>>n=Neural(nodes)# make Neural Object, __init__ requires nodes>>>n.shuffle()# shuffle all weights to be random (using random module)>>>print(n.input([1,2,3,4])# print out output neurons with input list>>>n.show()# visualize network using Tkinter>>>n.save("my_neural_network.txt")# save network to file_name.txtSetupDownload Python File/sInstalling them as Module using pipTutorial:http://www.discoversdk.com/blog/how-to-create-a-new-python-moduleExporting as aPublic Modulesoon!Use as Class in your ProjectCopy the File/s into your Project FolderImport the Class usingfrom neural import NeuralCreate Neural Object usingyourObj = Neural(nodes) # seeTutorialfor closer descriptionTutorial# setup network nodes with __init__(self, nodes)# nodes has to be a two dimensional array, containing floats/integers, representing nodes>nodes=[[0,0],[0,0,0,0],[0,0,0]]# 2 input neurons, 1 hidden layer containing 4 neurons, 3 output neurons>network1=Neural(nodes)# create Neural Object# input values using>network1.input([1,2])# pass 1D list, len must be equal to number of input neurons# show network (with Tkinter module, located in neuraldisplay.py) using>network1.show()# opens 1400px * 700px window>network1.show(size=[x,y])# modify window size# update every weight to be random from -1 to 1>network1.shuffle()# uses random module# update every weight to be in range of +- amount of given weights (of another neural network)>network1.shuffle_amount(amount)# amount will be devided by 100>network1.shuffle_amount(50)# to achieve a learning rate of 0.5# save network to file_name.txt to be loaded in later>network1.save(file_name)# file_name must be string ending in .txt (located in same directory)# load network from file_name.txt to current network>network1.load(file_name)# file_name must be string ending in .txt (located in same directory)Accessing the Network# Access Network List using>network1.nodes# Access individual layers using>network1.nodes[layer_number]# Access individual nodes dictionary using>network1.nodes[layer_number][position_in_layer]# Access output value of an individual node using>network1.nodes[layer_number][position_in_layer]["output"]# Access list of weights of an individual node using>network1.nodes[layer_number][position_in_layer]["weights"]Training using Backpropagation# setup network nodes with __init__(self, nodes)# nodes has to be a two dimensional array, containing floats/integers, representing nodes>nodes=[[0,0],[0,0,0,0],[0,0]]# 2 input neurons, 1 hidden layer containing 4 neurons, 2 output neurons>network1=Neural(nodes)# create Neural Object# load the training data using (see Training Data Formating)>inputs,outputs=network1.load_training_data("training_example.txt")# must be .txt file in the same directory# train the network using>network1.train(l_rate,# learning rate (e.g. 0.2)cycles,# how many cycles (epochs) the network will train through (e.g. 1000)inputs,# inputs set from loading the training dataoutputs,# outputs set from loading the training dataprint_status=True)# (optional) print progress into console (Default is False)# get the total score using (how many of your training examples it passes)>score,max_score=network1.get_total_score(inputs,outputs)# set score and max_score>print(f"{score}/{max_score}")# python 3 (f-strings)Training Data FormattingTraining Data to be read must be located in yourfilename.txt fileInputs must be seperated by Comma (e.g.1,2,3,4)Outputs must be seperated by Comma (e.g.0,1,0)Inputs and Outputs must be seperated by equal sign (e.g.1,2,3,4=0,1,0) ending in line break ("\n")see "training_example.txt"ScreenshotsStatusProject isIN PROGRESStodo list in PROJECT:Neural Network makerhttps://github.com/noel-friedrich/neural/projects/1CreditsTraining Algorithm Code was heavily inspired byhttps://machinelearningmastery.com/implement-backpropagation-algorithm-scratch-python/