MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / test_temporal_difference_agent

Function test_temporal_difference_agent

numpy_ml/plots/rl_plots.py:52–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50
51
52def test_temporal_difference_agent():
53 seed = 12345
54 max_steps = 200
55 n_episodes = 5000
56
57 lr = 0.4
58 n_tilings = 10
59 epsilon = 0.10
60 off_policy = True
61 grid_dims = [100, 100]
62 smooth_factor = 0.005
63 temporal_discount = 0.999
64 env = gym.make("LunarLander-v2")
65 obs_max = 1
66 obs_min = -1
67
68 agent = TemporalDifferenceAgent(
69 env,
70 lr=lr,
71 obs_max=obs_max,
72 obs_min=obs_min,
73 epsilon=epsilon,
74 n_tilings=n_tilings,
75 grid_dims=grid_dims,
76 off_policy=off_policy,
77 temporal_discount=temporal_discount,
78 )
79
80 trainer = Trainer(agent, env)
81 trainer.train(
82 n_episodes,
83 max_steps,
84 seed=seed,
85 plot=True,
86 verbose=True,
87 render_every=None,
88 smooth_factor=smooth_factor,
89 )
90
91
92def test_dyna_agent():

Callers

nothing calls this directly

Calls 3

trainMethod · 0.95
TrainerClass · 0.90

Tested by

no test coverage detected