Skip to content

Commit

Permalink
Ensure that PC does at least one comparison per iteration.
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestum committed Jan 11, 2024
1 parent d7a7da8 commit 55aa6eb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/imitation/algorithms/preference_comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,8 @@ def train(
unnormalized_probs = vec_schedule(np.linspace(0, 1, self.num_iterations))
probs = unnormalized_probs / np.sum(unnormalized_probs)
shares = util.oric(probs * total_comparisons)
shares[shares <= 0] = 1 # ensure we at least request one comparison per iteration

schedule = [initial_comparisons] + shares.tolist()
print(f"Query schedule: {schedule}")

Expand Down

0 comments on commit 55aa6eb

Please sign in to comment.