Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

_weighted_percentile NaN handling with array API #31368

Copy link
Copy link
Open
@lucyleeow

Description

@lucyleeow
Issue body actions

There isn't necessarily anything to fix here, but I thought it would be useful to open this for documentation, at least.


_weighted_percentile added support for NaN in #29034 and support for array APIs in #29431.

Our implementation relys on sort putting NaN values at the end:

largest_value_per_column = array[
sorted_idx[-1, ...], xp.arange(n_features, device=device)
]
# NaN values get sorted to end (largest value)
if xp.any(xp.isnan(largest_value_per_column)):

AFAICT (confirmed by @ev-br) array API specs do not specify how sort should handle NaN, which means it is left to individual packages to determine.

As everything works, I don't think we need to do anything here (especially as we ultimately want to drop maintaining our own quantile function), but just thought it would be useful to document.

cc @StefanieSenger @ogrisel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.