from JMSSNeural import *

training_data = [[[], []] for i in range(200)]          #list for 200 sets of training data
input_file = open("training_data", "r")                 #opening the training dataset file
for n, i in enumerate(input_file, 0):                   #for every dataline in the file
    line = i.split(",")                                 #split each dataline at the commas
    for bit in range(len(line)-1):                      #for every element in the split dataline excpet the last one
        training_data[n][0].append(int(line[bit]))      #append that element into the corresponding list
    training_data[n][1].append(int(line[-1]))           #append the target into a separate list within each dataset list

hidden_layer_nodes = 5                                  #>10 nodes would take forever to train, <3 network accuracy decreases substantially
epochs = 10000                                          #100000 would take too long, <1000 doesnt work at all
learning_rate = 1                                       #<=0.1 network fails to converge at minimum of cost function

network = nn_create(64, hidden_layer_nodes, 1)

network = nn_train(network, training_data, epochs, learning_rate)

print("network = " + str(network))