-
Notifications
You must be signed in to change notification settings - Fork 50
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
RFC: add isin
for elementwise set inclusion test
#854
Comments
Another potential reason for adding it is that it uses a nontrivial implementation which depends on some heuristics based on the input size. |
Thanks @lucascolley. I've added This seems like a very reasonable proposal to me. Implementing The return type should always be a boolean array. The NumPy docs say it can be a |
The thing to discuss here is what keywords are desired I think. NumPy and Dask use: def isin(element, test_elements, assume_unique=False, invert=False, *, kind=None) The private scikit-learn implementation here is: def isin(element, test_elements, xp, assume_unique=False, invert=False) JAX: def isin(element, test_elements, assume_unique=False, invert=False, *, method='auto') PyTorch: def isin(elements, test_elements, *, assume_unique=False, invert=False) ndonnx: def isin(x: Array, items: Sequence[Scalar]) -> Array The def isin(x: Array, test_elements: Array, /, *, assume_unique : bool = False, invert : bool =False) -> Array[bool] The type of |
We discussed this in the community meeting today. A summary with a couple of points to follow up on:
|
Prior art
isin
is not present yetMotivation
This function is used in scikit-learn. They've implemented it in terms of the standard, and that implementation could find a home in array-api-extra: data-apis/array-api-extra#34. @asmeurer suggested there that we should also consider adding this to the standard.
The text was updated successfully, but these errors were encountered: