-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add alternation environment #1
Conversation
This is a simple environment, which is easy to solve. It provides a quick means of sanity checking learning algorithms making sure they learn anything. The simplicity of the environment makes it easier to understand any obvious problems an algorithm might have. Additionally, it is quick to execute. A random agent will always perform poorly compared to an agent successfully learning the one winning strategy of this environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix comments
tests/test_alternation.py
Outdated
|
||
def test_agent_starts_randomly_left_or_right(sample_reset): | ||
avg_obs = sample_reset(100) | ||
assert left(avg_obs) == approx(0.5, abs=1) and right(avg_obs) == approx(0.5, abs=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the absolute approx is quite high
tests/test_alternation.py
Outdated
@pytest.fixture | ||
def sample_signal(): | ||
def sample_signal_func(func, n): | ||
total = 0 | ||
for _ in range(n): | ||
total += unpack_reward(func()) | ||
return total / n | ||
|
||
return sample_signal_func |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this is not used anymore
README.md
Outdated
|
||
![alteration graph](assets/alteration.png) | ||
|
||
The agent receives a normally distributed reward of 1 when switching from one state to the other, and a normally distributes penalty of -1 when staying in its current state. The environment terminates after a fixed amount of steps. This setup doesn't have any local minima the agent could reach. Hence most agents should be able to learn the optimal policy quickly. However, a random agent only achieves, on average, a total reward around zero. It makes this environment well suited for sanity checking algorithms making sure that they learn at all. By providing such a simple setup, it is also easier to comprehend any obvious problems an algorithm might have. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it kinda has a local minimum, like if it alternates 1 time and then stops or alternates 2 times and then stops, but the reward scales linearly - the more alternation the higher the reward. I should rephrase this to highlight this function
Fix readme, clarifying the purpose of the alternation environment. Remove superfluous code and make one of the statistical tests more robust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This is a simple environment, which is easy to solve. It provides a
quick means of sanity checking learning algorithms making sure they
learn anything. The simplicity of the environment makes it easier to
understand any obvious problems an algorithm might have. Additionally,
it is quick to execute. A random agent will always perform poorly
compared to an agent successfully learning the one winning strategy of
this environment.