Neurolab Reinstalls Network

I am using neurolab in python to create a neural netowork. I create a newff network and use the default train_bfgs training function. My problem is many times, the training ends before either the epoch ends, or even the goal of the error is reached. I looked around and found a post on the neurolabs github page, where they explained why this was happening. My problem is that if I re-run the program several times, it just catches and training starts, and then the error also drops (probably some random starting weights are much better than others). What I want to do is put some kind of test check on the workout, so that if the error is too high, and the workouts that have passed it are not even close to the sum, then reinstall the network (it’s like repeating a program) (possibly resetting the network weight by default)

Here is what I wrote, but obviously it is not working

 trainingComplete = False while not trainingComplete: error = net.train(trainingData, TS, epochs=50, show=10, goal=0.001) if len(error) < 0.8*epochs: if len(error) > 0 and min(error) < 0.01: trainingComplete = True else: net.reset() continue else: trainingComplete = True 

what happens when it passes the first condition, that is, there are too few training eras, it runs net.reset() before restarting, but then there is no training that happens, and it becomes an endless loop. Any idea what I am missing?

thanks

+5
source share
1 answer

So, Since this has not been responding for several days, and I think it is really bad for SO, so I took the responsibility of finding a job. I'm tired of restarting the script with os.execv(__file__, sys.argv) , but on my mac, which is always a permission issue, plus its too dirty, so this is how I can get it working now.

 # Train network print('Starting training....') trainingComplete = False while not trainingComplete: error = net.train(trainingData, TS, epochs=epochs, show=10, goal=0.001) if len(error) < 0.8 * epochs: if len(error) > 0 and min(error) < 0.01: trainingComplete = True else: print('Restarting....') net = createNeuralNetwork(trainingData, [hidden], 1) net.trainf = train_bfgs else: trainingComplete = True 

His pretty hacky, but interesting work:

 Starting training.... Restarting.... Restarting.... Restarting.... Restarting.... Restarting.... Restarting.... Restarting.... Restarting.... Epoch: 10; Error: 1.46314116045; Epoch: 20; Error: 0.759613243435; Epoch: 30; Error: 0.529574731856; . . 

Hope this helps someone

+1
source

Source: https://habr.com/ru/post/1239359/


All Articles