Test phase on custom environment
See original GitHub issueHi,
I’m experimenting with a custom env on rlpyt. I’ve the intention to use different data for training and testing (env shows novel states on testing/evaluation vs training).
I have been using example_1
as stepping stone, so far so good, but I’m not sure how to achieve this last bit: testing.
After running runner.train()
(as in example_1
, inside the logger), I think I should use runner.evaluate_agent()
inside a loop to evaluate the agent several times (or maybe use eval_max_steps=NumEvals
as SerialSampler argument?).
But I’m a bit (more) lost on how to “send” the test signal to my environment from here, as only the SerialSampler ‘knows’ where the environtment class is, and I cannot find a way to use it to send some arguments to the env in this phase.
In short (I don’t know if i’m being clear) I need to know how:
- to test/eval my agent
- to send a “test” argument to my custom env on testing phase
Thank you!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Actually the evaluation is performed using a separate instance of your environment, and this can be instantiated using different kwargs than the environment used for training. See
env_kwargs
andeval_env_kwargs
into the sampler. Sounds like exactly what you need. 😃https://github.com/astooke/rlpyt/blob/85d4e018a919118c6e42fac3e897aa346d84b9c5/examples/example_1.py#L29
Thanks for moving your question over!
Just for the record ended up solving the last issue like this:
Keep track of episode number on each environment instance (pass log interval as parameters). Define summary writer, and log from environment on each test call, and last 50 train runs before calling to test.
And in the environment:
Ugly as f*ck, but it works, so I’m closing this issue 😃