updating rwse to work at different times, updating correct testing environment from roundabout, removing the assertion that a collision implies done in the evaluator, using nanmean and nanstd in averaging

This commit is contained in:
Arec
2022-02-21 15:55:16 -08:00
parent daa4825f17
commit e7f8385628
5 changed files with 106 additions and 21 deletions

View File

@@ -214,7 +214,7 @@ def evaluate_policy(locations:List[Tuple[int,int]],
# initialize environment
Env = envs_dict[env_class]
eval_env = Env(**env_kwargs)
eval_env = Env(**it_env_kwargs)
evaluator = IntersimpleEvaluation(eval_env)
# load policy
@@ -303,7 +303,7 @@ def comparison_metrics(policy_metrics:List[Dict[str,list]],
expert_traj.append(np.vstack((expert_metrics[iR]['x_all'][iTraj], expert_metrics[iR]['y_all'][iTraj])))
policy_traj.append(np.vstack((policy_metrics[iR]['x_all'][iTraj], policy_metrics[iR]['y_all'][iTraj])))
assert len(expert_traj)==len(policy_traj)
comparison_metrics['rwse'] = rwse(expert_traj, policy_traj)
comparison_metrics.update(rwse(expert_traj, policy_traj))
# average velocity shortfall
expert_vavg = np.array(sum([d['v_avg'] for d in expert_metrics],[]))
@@ -356,7 +356,9 @@ def eval_main(
env (str): environment class
method (str): method (expert, bc, gail, rail, hgail, hrail)
"""
print(f'Evaluating {method} on {env}')
print(f'#############################################################################')
print(f'Evaluating {method} from file {policy_file} on {env} at locations {locations}')
print(f'#############################################################################')
# set seed
np.random.seed(seed)