-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
MNT: reference the proper variable in bootstrapper #7868
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
Conversation
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.
This looks good.
(I think at some point, we'll maybe have to expose a couple of parameters to make sure some elements are reproducible in this piece of code, but that is out of scope for this PR).
ii = np.random.randint(M, size=(N, M)) | ||
bsData = x[ii] | ||
bs_index = np.random.randint(M, size=(N, M)) | ||
bsData = data[bs_index] |
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.
np.random.choice(data, N * len(data), replace=True).reshape((N, 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.
@anntzer that looks like it would work too. Not sure that performance would be significantly impacted in either direction. So I'm going to punt of figuring out which is better until the refactor associated with MEP 28 like a mentioned in my comment to Nelle.
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.
np.random.choice(, ...) is basically implemented as array[np.random.randint(...)] so it's the same.
@@ -1941,8 +1941,8 @@ def _bootstrap_median(data, N=5000): | |||
M = len(data) | |||
percentiles = [2.5, 97.5] | |||
|
|||
ii = np.random.randint(M, size=(N, M)) | |||
bsData = x[ii] | |||
bs_index = np.random.randint(M, size=(N, 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.
Much better than before! Using underscored bs_index
next to camelcased bsData
is a bit strange... bsIndices
would be my choice. but I'm nitpicking :)
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 latter is not pep8 compliant, so I'd rather go for the pep8 compliant one though it is not coherent on this particular function.
I am very tempted not to wait for appveyor… |
Meh, unless we're cutting a release right now I don't see what merging early buys... |
@dopplershift We have a lot of pull requests opened right now, and if PRs don't appear on the first page, they tend to be forgotten by reviewers. |
Current coverage is 62.12% (diff: 100%)@@ master #7868 diff @@
==========================================
Files 174 174
Lines 56072 56072
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 34833 34833
Misses 21239 21239
Partials 0 0
|
Thanks @phobson ! |
Backported to |
MNT: reference the proper variable in bootstrapper
Cleans up some unclear code that magically worked due to python's scoping rules.
ref comment