From efef0b8dd9fd5e0eb0796bd6b14f583424b0c321 Mon Sep 17 00:00:00 2001 From: Jack McIvor Date: Tue, 31 Oct 2023 13:13:42 +0000 Subject: [PATCH 1/5] Fix bool deprecation --- ngboost/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ngboost/helpers.py b/ngboost/helpers.py index 88b7cfd..cc21b7a 100644 --- a/ngboost/helpers.py +++ b/ngboost/helpers.py @@ -17,7 +17,7 @@ def Y_from_censored(T, E=None): else: E = check_array(E, ensure_2d=False) E = E.reshape(E.shape[0]) - Y = np.empty(dtype=[("Event", np.bool), ("Time", np.float64)], shape=T.shape[0]) - Y["Event"] = E.astype(np.bool) + Y = np.empty(dtype=[("Event", np.bool_), ("Time", np.float64)], shape=T.shape[0]) + Y["Event"] = E.astype(np.bool_) Y["Time"] = T.astype(np.float64) return Y From 427eabd79d5534cee4694a5727ffa230fb7867d0 Mon Sep 17 00:00:00 2001 From: Jack McIvor Date: Tue, 31 Oct 2023 13:16:35 +0000 Subject: [PATCH 2/5] Minor boyscout fixes --- .pre-commit-config.yaml | 2 +- tests/test_distns.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 573751c..5c23809 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,7 +33,7 @@ repos: files: ^ngboost entry: flake8 - id: pylint-ngboost - name: pylint on nboost* + name: pylint on ngboost* types: [file, python] language: system files: ^ngboost diff --git a/tests/test_distns.py b/tests/test_distns.py index 4ece8e4..434fc70 100644 --- a/tests/test_distns.py +++ b/tests/test_distns.py @@ -26,8 +26,8 @@ # check metric lines up with defaults for lognormal where applicable -Tuple4Array = Tuple[np.array, np.array, np.array, np.array] -Tuple5Array = Tuple[np.array, np.array, np.array, np.array, np.array] +Tuple4Array = Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray] +Tuple5Array = Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray] @pytest.mark.slow @@ -151,7 +151,7 @@ def test_categorical(k: int, learner, breast_cancer_data: Tuple4Array): ) # Ignore the k=1 warning @pytest.mark.filterwarnings("ignore::UserWarning") -def test_multivariatenormal(k: 2, learner): +def test_multivariatenormal(k: int, learner): dist = MultivariateNormal(k) # Generate some sample data From 036e6cf5f87b7f62b620cde489a2ae173edfff1d Mon Sep 17 00:00:00 2001 From: Jack McIvor Date: Tue, 31 Oct 2023 16:15:59 +0000 Subject: [PATCH 3/5] Fix another np.bool --- examples/experiments/survival_exp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/experiments/survival_exp.py b/examples/experiments/survival_exp.py index 5c95522..c4bebd4 100644 --- a/examples/experiments/survival_exp.py +++ b/examples/experiments/survival_exp.py @@ -24,7 +24,9 @@ def Y_join(T, E): col_event = "Event" col_time = "Time" - y = np.empty(dtype=[(col_event, np.bool), (col_time, np.float64)], shape=T.shape[0]) + y = np.empty( + dtype=[(col_event, np.bool_), (col_time, np.float64)], shape=T.shape[0] + ) y[col_event] = E.values y[col_time] = T.values return y From 64bf2956f015a3f383ab08dd2c29e32ca1e76951 Mon Sep 17 00:00:00 2001 From: Jack McIvor Date: Tue, 31 Oct 2023 16:16:15 +0000 Subject: [PATCH 4/5] Update release notes --- RELEASE_NOTES.md | 4 ++++ pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index ff51514..d1b413b 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,9 @@ # RELEASE NOTES +## Version 0.4.2 +* Fix deprecated numpy type alias. This was causing a warning with NumPy >=1.20 and an error with NumPy >=1.24. +* Remove pandas as a declared dependency + ## Version 0.4.1 ### Added `partial_fit` method for incremental learning diff --git a/pyproject.toml b/pyproject.toml index 52405c3..233df06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ngboost" -version = "0.4.1dev" +version = "0.4.2dev" description = "Library for probabilistic predictions via gradient boosting." authors = ["Stanford ML Group "] readme = "README.md" From ab5a5f41aa3ed28ecccb0f232e5e7eeae58fb9c9 Mon Sep 17 00:00:00 2001 From: Jack McIvor Date: Tue, 31 Oct 2023 16:17:15 +0000 Subject: [PATCH 5/5] Typo --- RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d1b413b..ca099b0 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,7 +1,7 @@ # RELEASE NOTES ## Version 0.4.2 -* Fix deprecated numpy type alias. This was causing a warning with NumPy >=1.20 and an error with NumPy >=1.24. +* Fix deprecated numpy type alias. This was causing a warning with NumPy >=1.20 and an error with NumPy >=1.24 * Remove pandas as a declared dependency ## Version 0.4.1