February 1, 2023, 8:26am
This is kind of embarrassing, but, I can’t figure out how to change the seed=123 argument on the DQN_Cartpole experiment.
I threw the code into a Jupyter notebook, with the function in one big cell, then the
run(ex) each in their own cell. Everything runs fine but I want to add more arguments to the function and I can’t figure out how the function is called…
Among other things, I’ve tried:
hate being back to a newbie with a language!
I think the way to call this with the additional arguments is either
ex = E`JuliaRL_DQN_CartPole(seed=37)`
if you want to use the string macros (personally I think they mostly confuse things) or
ex = Experiment(Val(:JuliaRL), Val(:DQN), Val(:CartPole), nothing; seed=37)
if you want to use the method call.
If you want to change more things though, I would copy the env into my own function so I can mess with it best I want. So starting from the base file here
This file has been truncated.
# title: JuliaRL\_DQN\_CartPole
# cover: assets/JuliaRL_DQN_CartPole.png
# description: DQN applied to CartPole
# date: 2022-06-12
# author: "[Jun Tian](https://github.com/findmyway)"
using Flux: glorot_uniform
using StableRNGs: StableRNG
using Flux.Losses: huber_loss
you can set up a function to generate your experiment something like this
rng = StableRNG(seed)
env = CartPoleEnv(; T=Float32, rng=rng)
ns, na = length(state(env)), length(action_space(env))
agent = Agent(
stop_condition = StopAfterStep(10_000, is_show_progress=!haskey(ENV, "CI"))
hook = TotalRewardPerEpisode()
Experiment(agent, env, stop_condition, hook)
ex = my_experiment(; seed=37)