-
-
Notifications
You must be signed in to change notification settings - Fork 340
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
2.1 Introduction - Simple Example, procedural example #43
Comments
Yes, you're right but it does as you noticed it does not make a real difference. |
additionally, |
Yes, it has be noticed in #37 but the proposed solution require Python 3.6. However, from the documentation, the proposed sampling method should do a shuffle. |
Sorry, I didn't read the closed threads! A list comprehension like
won't require python 3.6. You may even want to use a generator expression, which might be more efficient. |
Oh nice, I like it. We need to benchmark it and if it faster or approximately the same, we can include it. Could you make a PR ? |
Benchmarks
So it looks like, that using random.sample from a false distribution yields a huge speedup. So the problem here is essentially, that numpy improves two things. |
Sorry, in the end I see your PR but the problem now is that the proposed solution does not correspond to the text so it is not good. What exactly is wrong with the |
Hey, that's what I feared. Secondly, you are reducing the variance/standard deviation by a huge amount. Though you approximate the same mean for large repetions, the distribution you'll use will be too narrow. This solution penalizes solutions that are far out too much. I think, this is easiest seen for the case n=2. This difference in variance carries over to higher number of repetitions (and it is significant!) So, one way would be to use np.randint() in all of the functions, maybe the best way would just be to comment on the issues with the variance and keep your solution. |
The random_walk function is not a direct equivalent to the RandomWalker class method. A strict equivalent would be this:
It is still not much faster, but it's a more fair comparison.
The text was updated successfully, but these errors were encountered: