Closed Tuxius closed 5 years ago
Hi @Tuxius, I can get a 90%+ accuracy on the train_generator
example, but I had to run it for many more epochs. Just increase the epochs
variable on line 41. At around 180 epochs I get over 90% accuracy. If I also switch the optimizer from sgd
to adadelta
(see page 171), I can hit that same accuracy target a lot faster.
However, it is important to keep in mind that it's only capable of hitting that super-high accuracy because it's essentially memorizing a tiny dataset. With a larger training set, the observed accuracy will be a lot lower, but it should generalize to new games better, and therefore it will be more useful for game play.
Hi macfergus,
thanks, I tried, it helped to some extent, but I still can't achieve your result or the book's. With epochs = 200
I only got a 37% val_acc
:
...
Epoch 1/200
1/76936 [..............................] - ETA: 29:23:50 - loss: 5.8886 - acc: 0.0000e+00
5/76936 [..............................] - ETA: 6:07:39 - loss: 5.8878 - acc: 0.0031
...
76936/76936 [==============================] - 1284s 17ms/step - loss: 1.9210 - acc: 0.5041 - val_loss: 2.7838 - val_acc: 0.3716
I can't see why?
What was your value for num_games
? With num_games = 100
I get this output:
...
Epoch 181/1000
88/88 [==============================] - 1s 11ms/step - loss: 0.3383 - acc: 0.9156 - val_loss: 0.3640 - val_acc: 0.9150
...
Note the "88/88" indicating there are only 88 positions in the training set -- which means it's easy for the network to memorize, but too small to really be useful. So that accuracy only demonstrates that everything is wired up correctly.
In your example I see 76936 positions in your training set, so it's a harder training set to memorize, but also a more realistic problem. 37% validation accuracy is pretty reasonable real-life accuracy. (I think it's probably possible to get close to 50%, but not much more than that, using the same general techniques covered in the book)
Thanks, yes, I can replicate that result if I only take 88 positions:
Epoch 180/180 88/88 [==============================] - 1s 15ms/step - loss: 0.3280 - acc: 0.9124 - val_loss: 0.3290 - val_acc: 0.9149
You say that is because the network memorized the 88 positions. But why is then the val_acc better than 90%? Shouldn't the validation be independent of the learning sample set?
Great fun reading this book :-)
Running the example train_generator.py of chapter 7.3 directly from the repository does not nearly achieve the accuracy of 98% mentioned in the book:
` /mnt/sambashare/wip3/code# python3 train_generator.py Using TensorFlow backend.
I can't see why - any ideas are highly welcome!
Best