Skip to content
This repository was archived by the owner on Aug 8, 2025. It is now read-only.

Conversation

jcbertin
Copy link

Removed usage of the ** operator in expo() generator.
Fixed default min_value for decay() generator: saved a test in the limit condition.
Saved a couple of tests for limit condition in all generators.

Comment on lines 54 to +61
t = 0
while True:
a = initial_value
while a > min_value:
yield a
t += 1
a = initial_value * math.e ** (-t * decay_factor)
if min_value is None or a > min_value:
yield a
t += 1
else:
yield min_value
while True:
yield min_value
Copy link

@yxtay yxtay Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following what's done in expo to remove use of **.

Suggested change
t = 0
while True:
a = initial_value
while a > min_value:
yield a
t += 1
a = initial_value * math.e ** (-t * decay_factor)
if min_value is None or a > min_value:
yield a
t += 1
else:
yield min_value
while True:
yield min_value
a = initial_value
while a > min_value:
yield a
a /= math.exp(decay_factor)
while True:
yield min_value

Alternatively for line 57.

        a *= math.exp(-decay_factor)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants