Skip to content

Commit

Permalink
Improve misleading function name and fix documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestum committed Oct 17, 2023
1 parent 7bc8dbe commit 1058f9a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions benchmarking/compute_probability_of_improvement.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
from imitation.util.sacred_file_parsing import SacredRun, group_runs_by_algo_and_env


def sample_matrix_from_runs_by_env(
def make_sample_matrix_from_runs_by_env(
runs_by_env: Dict[str, List[SacredRun]],
envs: Optional[List[str]] = None,
) -> np.ndarray:
"""Samples a matrix of scores from the runs for each environment.
"""Creates a matrix of scores from the runs for each environment.
Note: when the number of samples for each environment is not equal, the samples
will be truncated to the minimum sample count.
Expand Down Expand Up @@ -99,10 +99,10 @@ def compute_probability_of_improvement(
# We need to arrange the scores in a matrix of shape (n_samples, n_envs).
# When we do not have the same number of samples for each environment,
# the samples are truncated to the minimum sample count.
run_scores = sample_matrix_from_runs_by_env(runs_by_env, comparison_envs)
run_scores = make_sample_matrix_from_runs_by_env(runs_by_env, comparison_envs)
assert run_scores.shape[0] >= 1
assert run_scores.shape[1] == len(comparison_envs)
baseline_run_scores = sample_matrix_from_runs_by_env(
baseline_run_scores = make_sample_matrix_from_runs_by_env(
baseline_runs_by_env,
comparison_envs,
)
Expand Down

0 comments on commit 1058f9a

Please sign in to comment.