Repository navigation
Conversation
d047f2b to
f574c76
Compare
| chunks = ((np.nan,) * y.npartitions,) | ||
| if index.ndim < x.ndim: | ||
| x = x.reshape((-1,) + x.shape[index.ndim:]) | ||
| index = index.flatten() |
There was a problem hiding this comment.
This won't work if either array has an unknown length. Not sure of a good, simple way to fix this. Maybe it is ok to leave as is (considering this case was completely unsupported before as well).
There was a problem hiding this comment.
This is, I think, something that we want to support. the use case that I had in mind personally was for machine learning workloads, where the arrays almost always come from dataframes with unknown row-chunk sizes.
I believe that by default atop will allow nan-chunked arrays to interact with each other assuming that they have equivalent chunk sizes
There was a problem hiding this comment.
The problem is reshaping doesn't seem to be supported on arrays with unknown dimension lengths. Is that something that could be supported? If not, I don't know of a simple fix.
Makes a tweak to the handling of slicing of a Dask Array with a boolean Dask Array that may be smaller in size. Uses a technique based on the one used in `compress` to handle the unknown dimension lengths.
Exercises slicing an array with one of lower dimensionality.
f574c76 to
6ab6489
Compare
|
Probably not easily? I'm inclined just to wait until the full fix. I
don't think this is critical near-term.
…On Tue, Sep 5, 2017 at 3:00 PM, jakirkham ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In dask/array/core.py
<#2659 (comment)>:
> name = 'getitem-' + tokenize(x, index)
- dsk = {(name, i): k
- for i, k in enumerate(core.flatten(y._keys()))}
- chunks = ((np.nan,) * y.npartitions,)
+ if index.ndim < x.ndim:
+ x = x.reshape((-1,) + x.shape[index.ndim:])
+ index = index.flatten()
The problem is reshaping doesn't seem to be supported on arrays with
unknown dimension lengths. Is that something that could be supported? If
not, I don't know of a simple fix.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#2659 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AASszIkknbNZp4kpxW86ySEMWl9rqNP1ks5sfZo4gaJpZM4PNUU2>
.
|
|
However the full fix to that issue is quite a bit of work (as already noted). The last attempt at solving it (before your more recent one) has been untouched for 3 months. This suggests to me that we should break this problem up into smaller more achievable chunks to make it easier for more people to push it forward. Do you agree? I would think one problem is the one this PR tries to tackle. Namely allowing the mask to be smaller than the array it is applied to. There may be other ways to tackle it that are worth considering. Though I think solving a problem of this scope is a good first step. Once we solve this problem, it should be possible to build off such a solution and consider where that mask is positioned. As a next step, we could consider allowing multiple different masks for some axes of the array being sliced. It's my opinion that breaking this problem up will allow us to tackle it in a reasonable period of time instead of letting it idle for months. Plus it will be easier for interested contributors to pick up a piece of this work and complete it. |
In the general principle, yes, but this isn't the way in which I would break it up. Instead I would make a change to |
|
Should this be closed in favor of #2658 ? |
|
Thanks for working on PR ( #2658 ), @mrocklin. That will be very useful. In that PR bool arrays that are 1-D or the same dimensionality as the data were ok, but I don't think it was permissible to have a single bool array inbetween those two ranks (unless I'm missing something). The objective of this PR was to handle this inbetween case. That said, most of the cases I would want to handle are already well addressed by your PR. Though if solving this case is useful to others, I could rework it in the context of your PR pretty easily as you have already done the hard work. Just thinking about this briefly would do a reshape of the data and mask to get the mask to actually be 1-D before applying it. That said, this is easy for anyone to do themselves too. So would be happy either reworking this or closing it. Please let me know your thoughts. |
|
On second thought, I think this is just better off closed. |
Allows a Dask Array to be sliced with a boolean Dask Array that is smaller than the array it is slicing. This constitutes a very small, but useful step towards resolving issue ( #2651 ).