Skip to content
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

feat: Add nanquantile function to handle NaN-aware quantile calculations #28650

Closed
wants to merge 0 commits into from

Conversation

muzakkirhussain011
Copy link
Contributor

@muzakkirhussain011 muzakkirhussain011 commented Mar 20, 2024

Summary

This PR introduces the nanquantile function, which extends the existing quantile calculation functionality to handle NaN values in the input data.

Changes

  • Added nanquantile function that computes quantiles while ignoring NaN values.
  • Utilized the existing _validate_quantile function to ensure the quantiles are within the valid range.
  • Included unit tests to verify the correct behavior of the nanquantile function with various input scenarios.

Impact

The nanquantile function allows for more robust statistical analysis of datasets that contain missing or invalid entries. This enhancement ensures that our quantile calculations remain accurate and reliable even in the presence of NaN values.

Additional Notes

The implementation of nanquantile closely mirrors that of the standard quantile function but leverages NumPy's nanquantile method to ignore NaNs during computation. This addition is a valuable tool for data analysis tasks where data cleanliness cannot be guaranteed.

Releated Issues
#1529
#27497

Closes #26675

Checklist

  • Did you add a function?
  • Did you add the tests?
  • Did you run your tests and are your tests passing?
  • Did pre-commit not fail on any check?
  • Did you follow the steps we provided?

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Compliance Checks

Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.

Protected Branch

In order to be considered for merging, the pull request changes must not be implemented on the "main" branch. This is described in our Contributing Guide. We are closing this pull request and we would suggest that you implement your changes as described in our Contributing Guide and open a new pull request.

@muzakkirhussain011
Copy link
Contributor Author

muzakkirhussain011 commented Mar 20, 2024

Hi @Ishticode ,

I've submitted a new pull request and would appreciate your timely review. Your feedback is crucial for the ongoing improvements and I'm looking forward to your valuable comments.

Thank you for your attention!
Best Regards

Copy link
Contributor

@Ishticode Ishticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. Thank you for the PR.
To add a new function, we have to implement for all backends and add the test. So adding only in numpy would not be sufficient in the case of new backend addition. Let me know if omething is unclear. Maybe also worth a look through ivy's deep dive https://unify.ai/docs/ivy/overview/deep_dive.html. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nanquantile
2 participants