Skip to content

Commit

Permalink
Merge pull request #337 from jack-mcivor/bugfix/np-bool-deprecation
Browse files Browse the repository at this point in the history
Bugfix/np bool deprecation
  • Loading branch information
ryan-wolbeck committed Oct 31, 2023
2 parents 8a33fdf + ab5a5f4 commit f274cd3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 3 additions & 1 deletion examples/experiments/survival_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ngboost/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
readme = "README.md"
Expand Down
6 changes: 3 additions & 3 deletions tests/test_distns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f274cd3

Please sign in to comment.