stanfordmlgroup / ngboost

Natural Gradient Boosting for Probabilistic Prediction
Apache License 2.0
1.66k stars 219 forks source link

Deprecation warning for np.bool in Y_from_censored function #331

Closed Ali-RT closed 1 year ago

Ali-RT commented 1 year ago

Package Name: ngboost Package Version: 0.4.1 Operating System: MacOS Python Version: 3.9

Describe the bug: We encountered a deprecation warning when using the Y_from_censored function in the NGBoost library. Specifically, the line Y = np.empty(dtype=[("Event", np.bool), ("Time", np.float64)], shape=T.shape[0]) produces the warning: "FutureWarning: In the future np.bool will be defined as the corresponding NumPy scalar."

The error message suggests that np.bool is a deprecated alias for the built-in bool type, and advises using bool instead. This warning may impact the functionality of the library going forward.

To Reproduce: All that was required was running the python examples/simulations/survival_sim.py, which caused the program to stop halfway when using the current Y_from_censored function in helpers.py. However, with a slight adjustment made to helpers.py, the program was able to run normally.

jack-mcivor commented 1 year ago

This is also addressed in https://github.com/stanfordmlgroup/ngboost/pull/320

ryan-wolbeck commented 1 year ago

This should be fixed but let us know if you still have issues

pip install ngboost==0.4.2