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
BUG: weights.W.asymmetry does not support custom ids #540
Comments
Locally I've added the following to after line 1280: if isinstance(self.id_order[0], str):
id_order_array = np.asarray(self.id_order)
ids = tuple(id_order_array[ids[i]] for i in (0, 1)) This returns the correct ID labels if the labels are strings. Another thing we may consider though is if IDs are not strings, but numeric values that are not a 0-indexed range... @martinfleis Thoughts on this? |
Tests pass locally when simply leaving out the conditional: id_order_array = np.asarray(self.id_order)
ids = np.nonzero(wd)
ids = tuple(id_order_array[ids[i]] for i in (0, 1)) |
That is another valid case we should support. This one can be especially confusing. Your W is indexed by int, you get back int but it refers to position, not the value. |
2 more complications with indices that are not both (a) monotonically increasing integers and (b) 0-based:
|
Or just inverting |
This was my first thought, and absolutely the most simple solution. Actually doing the on-the-fly translation after the sorting on L1285 along with setting the Two more things to think about:
I have PR reading to push up for this, BTW. |
I am not sure how much energy I want to give thinking about future of
Does the sorting matter? |
Same and agreed at this point
I might say yes and no, especially for a custom ID case, like non-monotonic integers, where the index may not only not be increasing, but also out of "order". However, so long as we are clear in the docstring that a sorting is happening (which it currently is not), I suppose it wouldn't matter. |
So you just expect the output of |
As a user reading the docstring, I would not expect the returned Perhaps we should get other devs opinion on this? @knaaptime, @ljwolf, @sjsrey |
This should be a
list
of(i,j)
tuples, as per docstring but it is capturing integer ids coming from sparse.It should be this:
The text was updated successfully, but these errors were encountered: