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)[源代码]¶
- 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[源代码]¶
- 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[源代码]¶
- Overview:
Get the current episode. We can know which episode our evaluator is executing now.
- get_episode_info() dict[源代码]¶
- Overview:
Get all episode information, such as total return of one episode.
- get_latest_reward(env_id: int) int[源代码]¶
- 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[源代码]¶
- Overview:
Determine whether the evaluator has completed the work.
- Return:
result: (
bool): whether the evaluator has completed the work