worker.collector.base_serial_evaluator¶
base_serial_evaluator¶
Please Reference ding/worker/collector/base_serial_evaluator.py for usage
ISerialEvaluator¶
VectorEvalMonitor¶
- class ding.worker.collector.base_serial_evaluator.VectorEvalMonitor(env_num: int, n_episode: int)[source]¶
- Overview:
In some cases, different environment in evaluator may collect different length episode. For example, suppose we want to collect 12 episodes in evaluator but only have 5 environments, if we didn’t do any thing, it is likely that we will get more short episodes than long episodes. As a result, our average reward will have a bias and may not be accurate. we use VectorEvalMonitor to solve the problem.
- Interfaces:
__init__, is_finished, update_info, update_reward, get_episode_return, get_latest_reward, get_current_episode, get_episode_info
- __init__(env_num: int, n_episode: int) None [source]¶
- Overview:
Init method. According to the number of episodes and the number of environments, determine how many episodes need to be opened for each environment, and initialize the reward, info and other information
- Arguments:
env_num (
int
): the number of episodes need to be openn_episode (
int
): the number of environments
- get_current_episode() int [source]¶
- Overview:
Get the current episode. We can know which episode our evaluator is executing now.
- get_episode_info() dict [source]¶
- Overview:
Get all episode information, such as total return of one episode.
- get_episode_return() list [source]¶
- Overview:
Sum up all reward and get the total return of one episode.
- get_latest_reward(env_id: int) int [source]¶
- Overview:
Get the latest reward of a certain environment.
- Arguments:
env_id: (
int
): the id of the environment we need to get reward.
- is_finished() bool [source]¶
- Overview:
Determine whether the evaluator has completed the work.
- Return:
result: (
bool
): whether the evaluator has completed the work