Skip to content

Commit

Permalink
fix: set randomness only the first time when benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamantios committed Jul 16, 2024
1 parent 0936436 commit a70b5b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _select_tool(self) -> Generator[None, None, Optional[str]]:
return None

randomness = (
self.benchmarking_mode.randomness
(self.benchmarking_mode.randomness if self.is_first_period else None)
if self.benchmarking_mode.enabled
else self.synchronized_data.most_voted_randomness
)
Expand Down
6 changes: 4 additions & 2 deletions packages/valory/skills/decision_maker_abci/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ def update_weighted_accuracy(self) -> None:
for tool, acc_info in self.accuracy_store.items()
}

def select_tool(self, randomness: RandomnessType) -> Optional[str]:
def select_tool(self, randomness: RandomnessType = None) -> Optional[str]:
"""Select a Mech tool and return its index."""
if self.n_tools == 0:
return None

random.seed(randomness)
if randomness is not None:
random.seed(randomness)

if not self.has_updated or random.random() < self.eps: # nosec
return self.random_tool

Expand Down

0 comments on commit a70b5b8

Please sign in to comment.