print "Begining training the neural network:" # iterate through to train the neural network while total_runs < NUM_TRAINING_ITERATIONS: # set the new input values x.input_vals = attrs[curr_point] # set up the first layer and evaluate it x.input_vals = attrs[curr_point] x.eval() # set up the second layer and evaluate it y.input_vals = x.layer_out y.eval() # backpropogate y.backprop(target[curr_point]) x.backprop(y) # get the current error curr_err = err(y.layer_out[0], target[curr_point]) # round up and down to check err if y.layer_out[0] >= 0.5: temp = 1 else: temp = 0 # increment the number incorrect if its wrong if(temp != target[curr_point]): num_incorrect += 1