sktime / skpro

A unified framework for tabular probabilistic regression, time-to-event prediction, and probability distributions in python
https://skpro.readthedocs.io/en/latest
BSD 3-Clause "New" or "Revised" License
250 stars 46 forks source link

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

Closed ShreeshaM07 closed 5 months ago

ShreeshaM07 commented 5 months ago

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
For new estimators
ShreeshaM07 commented 5 months ago

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.