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

Sample stable inputs in tests of group normalization #7894

Merged
merged 3 commits into from Aug 9, 2019

Conversation

toslunar
Copy link
Member

@toslunar toslunar commented Aug 8, 2019

Fix #6911.

if x_groups.std(axis=2).min() >= min_std:
break
retry += 1
assert retry <= 10, 'Too many retries to generate inputs'
Copy link
Member

Choose a reason for hiding this comment

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

I find this fine, I am just curious about how many retries does it take on average to sample a good input :).

Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

For example, shape=(3, 20), groups=4 samples 5 per group. For each group std ≥ 0.2 with probability ~97.8%.

>>> (np.random.uniform(-1, 1, (1000000, 5)).std(axis=1) > 0.2).sum()
978456

A try satisfies the condition for all groups with probability at least 0.97 ** (3 * 4). Thus it fails 10 tries with probability

>>> (1 - 0.97 ** (3 * 4)) ** 10
7.235207665894931e-06

... I see. It's not sufficiently small.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks a lot for the great explanation!

Copy link
Member

@emcastillo emcastillo left a comment

Choose a reason for hiding this comment

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

LGTM

@emcastillo
Copy link
Member

Jenkins, test this please

@emcastillo emcastillo added cat:test Test or CI related. to-be-backported Pull request that should be backported. labels Aug 9, 2019
@emcastillo emcastillo added this to the v7.0.0b3 milestone Aug 9, 2019
@chainer-ci
Copy link
Member

Jenkins CI test (for commit c66a532, target branch master) failed with status FAILURE.

@emcastillo
Copy link
Member

CI unrelated

@emcastillo emcastillo merged commit af7b988 into chainer:master Aug 9, 2019
emcastillo pushed a commit to emcastillo/chainer that referenced this pull request Aug 9, 2019
Sample stable inputs in tests of group normalization
@toslunar toslunar deleted the test-gn branch August 9, 2019 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:test Test or CI related. to-be-backported Pull request that should be backported.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_group_normalization is flaky
3 participants