def rundeltamultibatch(n_nodes_v, epochs): start = time.time() # Create weight matrices net = NeuralNet() n_layers = len(n_nodes_v) - 1 print("Layers = ", n_layers) for l in range(n_layers + 1): net.add_layer(n_nodes_v[l]) print(net) net.generate_weights() err = [] val = [] x = [] net.set_inputs(0, shuffledx) net.set_y(0, shuffledx) net.forward_pass() net.backward_pass(T) step_v = np.vectorize(step) first_classification = T - (np.ceil(net.get_outputs()) * 2 - 1) # print(net.get_outputs()) for epoch in range(epochs): net.forward_pass() net.backward_pass(T) net.update() # print(np.mean(np.square(net.get_error()))) x.append(epoch) err.append(np.mean(np.square(net.get_error()))) val.append(np.count_nonzero(T - (np.ceil(net.get_outputs()) * 2 - 1))) # print(first_classification) # print(T - (np.ceil(net.get_outputs())*2-1)) # print(T) # print(net.get_outputs()) # print(np.ceil(net.get_outputs())*2-1) print("Time elapsed: ", round(time.time() - start, 3), " seconds") plot_err_val(x, err, val) # plotpoints(shuffledx) show_plots()