Repository navigation
Update groupbyclass.py - #434
Conversation
take care of out of scope object refs from Strings case which were not alive during server operation
fixed syntax error
reenable groupby test case which was skipped before because of sporatic failure
file skipna default from False to True on aggregate
|
I flipped the default value for |
|
|
||
| # https://github.com/mhmerrill/arkouda/issues/365 | ||
| @unittest.skip | ||
| #@unittest.skip |
There was a problem hiding this comment.
Still fails for me ~1/20 trials. There's probably a one-liner for this, but I'm just testing with:
#!/usr/bin/env bash
for run in {1..100}; do
python3 -m pytest tests/groupby_test.py
if [ $? -ne 0 ]; then
exit 1
fi
doneThere was a problem hiding this comment.
@ronawho can you look for a message on the failure which looks like:
Different values (abs diff = nan)
this is what is printed when the answers don't match between pandas and arkouda.
which reduction is failing? Is it always the same one?
for me it was:
Doing aggregate(int64, prod)
Different values (abs diff = nan)
I ran your script and failed after 15 successes
There was a problem hiding this comment.
It's not clear to me where the actual failure occurs, but I do see:
Doing aggregate(int64, prod)
Different values (abs diff = nan)
I updated my script to just print failures to a file:
for run in {1..100}; do
python3 -m pytest tests/groupby_test.py &> out.txt
if [ $? -ne 0 ]; then
cat out.txt >> failures.txt
echo "Failure"
fi
doneAnd here's the log for 4 failures: failures.txt
There was a problem hiding this comment.
@reuster986 @mcdobe100 it seems we did not implement skipna for the segmented product reduction. Or for segmented argmin or argmax
https://github.com/mhmerrill/arkouda/blob/f3e75a28ea47e29cb91c7ecc53e85da0161443e8/src/ReductionMsg.chpl#L315-L325
https://github.com/mhmerrill/arkouda/blob/f3e75a28ea47e29cb91c7ecc53e85da0161443e8/src/ReductionMsg.chpl#L588-L607
There was a problem hiding this comment.
@reuster986 it occurred to me that the log(0) is undefined, what if zero is sneaking into the computation. That would produce NaN wouldn't it. Maybe the algorithm here takes care of this but I keep seeing NaN from the check routine in the test.
There was a problem hiding this comment.
@reuster986 I was going to put an issue in to cover this and decouple the logic fix from this PR so we would not delay these changes. Unless you are going to get the logic change done and tested... today or tomorrow.
if you want I would like you to check your changes into this branch, so they go in with this PR.
There was a problem hiding this comment.
I'm running the 100-fold test right now. Assuming it passes, I can check the changes into this branch.
There was a problem hiding this comment.
it seems we did not implement skipna for the segmented product reduction. Or for segmented argmin or argmax
@mhmerrill Yes, that is correct, we only implemented skipna for min, max, sum, and mean. Would you like it to be extended to those operations as well? The reason we only went with those 4 is that the original intent for skipna was motivated by Roland's use, which only required the use of those 4, but I think it makes sense to have it implemented for all of them if you want that done as well.
There was a problem hiding this comment.
@mcdobe100 The code I'm testing right now includes skipna for prod. Since I was writing code for handling zeros, it was relatively easy to do the same for NaNs at the same time.
There was a problem hiding this comment.
I think I discovered a bug in pandas. When doing groupby followed by .aggregate('prod'), pandas will sometimes compute a nan when the product should be zero. I discovered this by manually generating a dataframe with int64 columns, doing a groupby-aggregate with prod, and finding a group with nan product. Then, I manually sliced out the group from the original dataframe and computed the true product, which was 0.
I believe the pandas bug is the root cause of the intermittent test failures. In the latest commit, I modified groupby_test.py to replace nan with 0 in the pandas prod result, and I ran the 100-fold test with no failures.
|
Ok, I think this PR is ready to go. |
fixes #432
take care of out of scope object refs (h1 and h2) from the Strings case which were not alive and deleted before the server operation started
original code is here https://github.com/mhmerrill/arkouda/blob/b75031c3c2e219d550588dd6fe9bb76fbaef1623/arkouda/groupbyclass.py#L104-L125