I already know how to train a neural net with NeuroLab and get the error every X epochs, but I want to get the final error after training the net.
nn = nl.net.newff([[min_val, max_val]], [40, 26, 1])
# Gradient descent
nn.trainf = nl.train.train_gd
# Train the neural network
error_progress = nn.train(data, labels, epochs=6000, show=100, goal=0.0005)
# CODE TO GET THE ERROR AFTER TRAINING HERE
# final_error = ?
EDIT: By final_error I mean the final value of the Error variable that the net.train
command plots (ONLY the error, not the complete string, as it plots in the following format).
Epoch: 1700; Error: 0.0005184049;
Okay, so the best way I have found until now is to save the error progress and then get the last item in the array.
# Train the neural network
error_progress = net.train(data, labels, epochs=10000, show=100, goal=0.01)
# THIS IS THE LAST ERROR VALUE THE NET OUTPUTS
final_error = error_progress[-1]