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

[BUG] Histogram Distribution: address np.broadcast_arrays deprecation of writable return in numpy 2.0.0 #414

Merged
merged 1 commit into from
Jun 30, 2024

Conversation

ShreeshaM07
Copy link
Contributor

Reference Issues/PRs

fixes #412

What does this implement/fix? Explain your changes.

The error is due to the deprecation of the np.broadcast_arrays. https://numpy.org/doc/stable/reference/generated/numpy.broadcast_arrays.html
So the bc is actually a tuple with broadcasted arrays whose values are getting reassigned.

PR checklist

For all contributions
  • I've added myself to the list of contributors with any new badges I've earned :-)
    How to: add yourself to the all-contributors file in the skpro root directory (not the CONTRIBUTORS.md). Common badges: code - fixing a bug, or adding code logic. doc - writing or improving documentation or docstrings. bug - reporting or diagnosing a bug (get this plus code if you also fixed the bug in the PR).maintenance - CI, test framework, release.
    See here for full badge reference
  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
For new estimators
  • I've added the estimator to the API reference - in docs/source/api_reference/taskname.rst, follow the pattern.
  • I've added one or more illustrative usage examples to the docstring, in a pydocstyle compliant Examples section.
  • If the estimator relies on a soft dependency, I've set the python_dependencies tag and ensured
    dependency isolation, see the estimator dependencies guide.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

Makes sense - though, general question, is there a way we can avoid writing to the broadcast views?

That would be preferable for memory efficiency.

@fkiraly fkiraly added bug module:probability&simulation probability distributions and simulators labels Jun 28, 2024
@ShreeshaM07
Copy link
Contributor Author

Makes sense - though, general question, is there a way we can avoid writing to the broadcast views?

I don't think that's possible as the logic for the broadcasting of these ragged arrays is that I replace these ragged arrays with an int that represents the index which is then broadcasted based on the shape of index and columns parameters. I am then replacing these int back with the ragged arrays. So I'm not sure if there's a way to avoid writing to broadcast views.

@fkiraly fkiraly changed the title [BUG] Histogram Distribution np.broadcast_arrays deprecation in v2.0.0 [BUG] Histogram Distribution: address np.broadcast_arrays deprecation of writable return in numpy 2.0.0 Jun 30, 2024
@fkiraly fkiraly merged commit f63b60c into sktime:main Jun 30, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug module:probability&simulation probability distributions and simulators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Histogram distribution fails to construct on numpy 2
2 participants