6. Monte Carlo Methods
Activity 6.01: Exploring the Frozen Lake Problem – the Reward Function
- Import the necessary libraries:
import gym import numpy as np from collections import defaultdict
- Select the environment as
FrozenLake
.is_slippery
is set toFalse
. The environment is reset with the lineenv.reset()
and rendered with the lineenv.render()
:env = gym.make("FrozenLake-v0", is_slippery=False) env.reset() env.render()
You will get the following output:
This is a text grid with the letters
S
,F
,G
, andH
used to represent the current environment ofFrozenLake
. The highlighted cellS
is the current state of the agent. - Print the possible values in the observation space and the number of action values using the
print(env.observation_space)
andprint(env.action_space)
functions respectively:print(env.observation_space) print(env.action_space) name_action = {0:'Left',1:'Down',2:'Right'...