-
Notifications
You must be signed in to change notification settings - Fork 999
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
chore: add balls and bins simulator #2001
Conversation
Signed-off-by: Roman Gershman <[email protected]>
tools/balls_bins.py
Outdated
import matplotlib.pyplot as plt | ||
|
||
|
||
def simulate_balls_into_bins(balls: int, N, threshold: int, exact, trials=10000): |
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.
tiny nit, if you plan to expand this in the future, replace N
with bins since you already use balls
instead of M
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.
fixed
print( | ||
f"Histogram of the difference between the most and least populated bins for {args.trials} trials" | ||
) | ||
plt.hist(deltas, bins=30, color="steelblue", edgecolor="none") |
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.
Why are you limiting to 30 bins? I guess if we experiment with a large size of args.bins
we will get large deltas
and a lot of the data points will end up on the last bucket (bin 30). Is this intented?
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.
30 bins is 30 buckets that I assume would be defined according to the data distribution (auto bins).
pre-approved so I don't block you, if you think some of my comments are applicable let me know :) |
Signed-off-by: Roman Gershman <[email protected]>
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.
👍🏻 like for using numpy
No description provided.