-
Notifications
You must be signed in to change notification settings - Fork 93
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
Closes #3086: Add choice
to random number generators
#3114
Conversation
The tests are passing for me with chpl 2.0. |
@stress-tess, looking at your code nothing is standing out as incorrect. I'm guessing there is an issue with choice itself. I'll checkout your branch and see if I can figure it out. |
Yep, unfortunately it looks like there is a subtle bug in choice where it can call the module-level patch for Chapel 1.33...diff --git a/modules/standard/Random.chpl b/modules/standard/Random.chpl
index 51e8d8723f..b5c50ed4c2 100644
--- a/modules/standard/Random.chpl
+++ b/modules/standard/Random.chpl
@@ -948,7 +948,7 @@ module Random {
}
} else {
var indices: [X] int = X;
- shuffle(indices);
+ stream.shuffle(indices);
for i in samples.domain {
samples[i] = (indices[X.dim(0).orderToIndex(i)]);
} I'm not sure whether this is worth fixing, but I suppose the solution would be to add a correct implementation of choice to Arkouda instead of calling the implementation in the Random module. |
thanks so much for running this down for me @jeremiah-corrado!! Unfortunately I think most of our users haven't made the jump to I was thinking I might skip that test for now and then add the correct choice impl in a separate issue and re-enable the test then. @Bears-R-Us/arkouda-core-dev , what are y'all's thoughts on that? Captured in #3118 |
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.
Looks good to me! I like how you used the chi-squared test :)
This PR (closes Bears-R-Us#3086) adds `choice` to random number generators. I had to make a very slight modification to `sampleDomWeighted` (just moving the increment to be after indexing) to avoid an out of bounds error.
44dc522
to
ff24db2
Compare
This PR closes Bears-R-Us#3118 by moving the implemention of `choice` into arkouda for chpl versions prior to 2.0. This allows us to no longer skip `test_choice_flags`. We could have done this as part of Bears-R-Us#3114, since it was much less involved than I thought it would be. I was expecting to need to copy several internal procs and records from chpl's random modules, but it more or less just worked to copy it over and change `sample` to `stream.sample`
This PR closes #3118 by moving the implemention of `choice` into arkouda for chpl versions prior to 2.0. This allows us to no longer skip `test_choice_flags`. We could have done this as part of #3114, since it was much less involved than I thought it would be. I was expecting to need to copy several internal procs and records from chpl's random modules, but it more or less just worked to copy it over and change `sample` to `stream.sample` Co-authored-by: Tess Hayes <[email protected]>
This PR (closes #3086) adds
choice
to random number generators.I had to make a very slight modification to
sampleDomWeighted
(just moving the increment to be after indexing) to avoid an out of bounds error.