Skip to Content
Reinforcement Learning with TensorFlow
book

Reinforcement Learning with TensorFlow

by Sayon Dutta
April 2018
Intermediate to advanced content levelIntermediate to advanced
334 pages
10h 18m
English
Packt Publishing
Content preview from Reinforcement Learning with TensorFlow

Training the FrozenLake-v0 environment using MDP

This is about a gridworld environment in OpenAI gym called FrozenLake-v0, discussed in Chapter 2, Training Reinforcement Learning Agents Using OpenAI Gym. We implemented Q-learning and Q-network (which we will discuss in future chapters) to get the understanding of an OpenAI gym environment.

Now, let's try to implement value iteration to obtain the utility value of each state in the FrozenLake-v0 environment, using the following code:

# importing dependency librariesfrom __future__ import print_functionimport gymimport numpy as npimport time#Load the environmentenv = gym.make('FrozenLake-v0')s = env.reset()print(s)print()env.render()print()print(env.action_space) #number of actionsprint(env.observation_space) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Deep Learning with TensorFlow - Second Edition

Deep Learning with TensorFlow - Second Edition

Giancarlo Zaccone, Vihan Jain, Md. Rezaul Karim, Motaz Saad
Deep Learning with TensorFlow 2 and Keras - Second Edition

Deep Learning with TensorFlow 2 and Keras - Second Edition

Antonio Gulli, Dr. Amita Kapoor, Sujit Pal

Publisher Resources

ISBN: 9781788835725Supplemental Content