O'Reilly logo

Python Reinforcement Learning Projects by Rajalingappaa Shanmugamani, Yang Wenzhuo, Sean Saito

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

preprocessing.py

The preprocessing.py module mainly deals with reading from and writing to TFRecords files, which is TensorFlow's native data-representation file format. When training AlphaGo Zero, we store MCTS self-play results and moves. As discussed, these then become the ground truths from which PolicyValueNetwork learns. TFRecords provides a convenient way to save historical moves and results from MCTS. When reading these from disk, preprocessing.py turns TFRecords into tf.train.Example, an in-memory representation of data that can be directly fed into tf.estimator.Estimator.

 tf_records usually have filenames that end with *.tfrecord.zz.

The following function reads from a TFRecords file. We first turn a given list of TFRecords into ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required