浏览代码

removed opponent elo from stat collection

/asymm-envs
Andrew Cohen 5 年前
当前提交
03b40795
共有 2 个文件被更改,包括 7 次插入21 次删除
  1. 15
      ml-agents/mlagents/trainers/ghost/trainer.py
  2. 13
      ml-agents/mlagents/trainers/stats.py

15
ml-agents/mlagents/trainers/ghost/trainer.py


self.current_elo, result
)
self.change_current_elo(change)
# opponents = np.array(self.policy_elos, dtype=np.float32)
# self._stats_reporter.add_stat(
# "Self-play/Mean Opponent ELO", opponents.mean()
# )
# self._stats_reporter.add_stat("Self-play/Std Opponent ELO", opponents.std())
def advance(self) -> None:
"""

except AgentManagerQueue.Empty:
pass
self.learning_team = self.controller.get_learning_team(self.ghost_step)
if self.ghost_step - self.last_save > self.steps_between_save:
self._save_snapshot(self.trainer.policy)
self.last_save = self.ghost_step

self.last_swap = self.ghost_step
self.learning_team = self.controller.get_learning_team(self.ghost_step)
def end_episode(self):
self.trainer.end_episode()

self._save_snapshot(policy) # Need to save after trainer initializes policy
self.learning_team = team_id
self.wrapped_trainer_team = team_id
self._stats_reporter.add_property(StatsPropertyType.SELF_PLAY_TEAM, team_id)
else:
# for saving/swapping snapshots
policy.init_load_weights()

self.current_opponent = -1 if x == "current" else x
logger.debug(
"Step {}: Swapping snapshot {} to id {} with {} learning".format(
self.get_step, x, parsed_behavior_id.behavior_id, self.learning_team
self.ghost_step,
x,
parsed_behavior_id.behavior_id,
self.learning_team,
)
)
policy = self.get_policy(parsed_behavior_id.behavior_id)

13
ml-agents/mlagents/trainers/stats.py


)
if self.self_play and "Self-play/ELO" in values:
elo_stats = values["Self-play/ELO"]
# mean_opponent_elo = values["Self-play/Mean Opponent ELO"]
# std_opponent_elo = values["Self-play/Std Opponent ELO"]
logger.info(
"{} Team {}: ELO: {:0.3f}. ".format(
category, self.self_play_team, elo_stats.mean
)
# mean_opponent_elo.mean,
# std_opponent_elo.mean,
)
logger.info("{} ELO: {:0.3f}. ".format(category, elo_stats.mean))
else:
logger.info(
"{}: Step: {}. No episode was completed since last summary. {}".format(

elif property_type == StatsPropertyType.SELF_PLAY:
assert isinstance(value, bool)
self.self_play = value
elif property_type == StatsPropertyType.SELF_PLAY_TEAM:
assert isinstance(value, int)
self.self_play_team = value
def _dict_to_str(self, param_dict: Dict[str, Any], num_tabs: int) -> str:
"""

正在加载...
取消
保存