Skip to content

Commit

Permalink
generate in log scale if desired
Browse files Browse the repository at this point in the history
  • Loading branch information
Rylie Weaver committed Feb 12, 2024
1 parent 25dd2ac commit 72ababa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion workflows/common/python/ga_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def randomDraw(self):
if self.use_log_scale:
log_lower = math.log10(self.lower)
log_upper = math.log10(self.upper)
return self.log_uniform(log_lower, log_upper)
# Generate a random value in log scale
random_log_value = self.log_uniform(log_lower, log_upper)
# Convert it back to the original scale
return 10 ** random_log_value
else:
return super(FloatParameter, self).randomDraw()

Expand Down

0 comments on commit 72ababa

Please sign in to comment.