Skip to content
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

Merged
merged 3 commits into from
Oct 27, 2019
Merged

Add alternation environment #1

merged 3 commits into from
Oct 27, 2019

Conversation

SwamyDev
Copy link
Owner

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.

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.
Copy link
Owner Author

@SwamyDev SwamyDev left a comment

Choose a reason for hiding this comment

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

Fix comments


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)
Copy link
Owner Author

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

Comment on lines 41 to 49
@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
Copy link
Owner Author

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.
Copy link
Owner Author

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.
Copy link
Owner Author

@SwamyDev SwamyDev left a comment

Choose a reason for hiding this comment

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

Done

@SwamyDev SwamyDev merged commit 036c71e into master Oct 27, 2019
@SwamyDev SwamyDev deleted the alternation branch October 27, 2019 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant