Skip to content

Commit bf83ae6

Browse files
Elbert Fliekmichaelosthege
authored andcommitted
Replace deprecated np.bool by native bool
1 parent b49aa1f commit bf83ae6

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

pymc3/step_methods/hmc/hmc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class HamiltonianMC(BaseHMC):
3939
{
4040
"step_size": np.float64,
4141
"n_steps": np.int64,
42-
"tune": np.bool,
42+
"tune": bool,
4343
"step_size_bar": np.float64,
4444
"accept": np.float64,
45-
"diverging": np.bool,
45+
"diverging": bool,
4646
"energy_error": np.float64,
4747
"energy": np.float64,
4848
"path_length": np.float64,
49-
"accepted": np.bool,
49+
"accepted": bool,
5050
"model_logp": np.float64,
5151
"process_time_diff": np.float64,
5252
"perf_counter_diff": np.float64,

pymc3/step_methods/hmc/nuts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ class NUTS(BaseHMC):
9494
{
9595
"depth": np.int64,
9696
"step_size": np.float64,
97-
"tune": np.bool,
97+
"tune": bool,
9898
"mean_tree_accept": np.float64,
9999
"step_size_bar": np.float64,
100100
"tree_size": np.float64,
101-
"diverging": np.bool,
101+
"diverging": bool,
102102
"energy_error": np.float64,
103103
"energy": np.float64,
104104
"max_energy_error": np.float64,

pymc3/step_methods/metropolis.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ class Metropolis(ArrayStepShared):
104104
stats_dtypes = [
105105
{
106106
"accept": np.float64,
107-
"accepted": np.bool,
108-
"tune": np.bool,
107+
"accepted": bool,
108+
"tune": bool,
109109
"scaling": np.float64,
110110
}
111111
]
@@ -295,7 +295,7 @@ class BinaryMetropolis(ArrayStep):
295295
stats_dtypes = [
296296
{
297297
"accept": np.float64,
298-
"tune": np.bool,
298+
"tune": bool,
299299
"p_jump": np.float64,
300300
}
301301
]
@@ -589,8 +589,8 @@ class DEMetropolis(PopulationArrayStepShared):
589589
stats_dtypes = [
590590
{
591591
"accept": np.float64,
592-
"accepted": np.bool,
593-
"tune": np.bool,
592+
"accepted": bool,
593+
"tune": bool,
594594
"scaling": np.float64,
595595
"lambda": np.float64,
596596
}
@@ -730,8 +730,8 @@ class DEMetropolisZ(ArrayStepShared):
730730
stats_dtypes = [
731731
{
732732
"accept": np.float64,
733-
"accepted": np.bool,
734-
"tune": np.bool,
733+
"accepted": bool,
734+
"tune": bool,
735735
"scaling": np.float64,
736736
"lambda": np.float64,
737737
}

pymc3/step_methods/mlda.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ def __init__(
667667

668668
else:
669669
# otherwise, set it up from scratch.
670-
self.stats_dtypes = [{"accept": np.float64, "accepted": np.bool, "tune": np.bool}]
670+
self.stats_dtypes = [{"accept": np.float64, "accepted": bool, "tune": bool}]
671671

672672
if isinstance(self.step_method_below, MetropolisMLDA):
673673
self.stats_dtypes.append({"base_scaling": np.float64})

pymc3/tests/backend_fixtures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def test_append_invalid(self):
6161
with pytest.raises(ValueError):
6262
self.strace.setup(self.draws, self.chain)
6363
with pytest.raises(ValueError):
64-
vars = self.sampler_vars + [{"a": np.bool}]
64+
vars = self.sampler_vars + [{"a": bool}]
6565
self.strace.setup(self.draws, self.chain, vars)
6666
else:
6767
with pytest.raises((ValueError, TypeError)):
68-
self.strace.setup(self.draws, self.chain, [{"a": np.bool}])
68+
self.strace.setup(self.draws, self.chain, [{"a": bool}])
6969

7070
def test_append(self):
7171
if self.sampler_vars is None:
@@ -103,7 +103,7 @@ def setup_method(self):
103103
self.draws, self.chain = 3, 0
104104

105105
def test_bad_dtype(self):
106-
bad_vars = [{"a": np.float64}, {"a": np.bool}]
106+
bad_vars = [{"a": np.float64}, {"a": bool}]
107107
good_vars = [{"a": np.float64}, {"a": np.float64}]
108108
with self.model:
109109
strace = self.backend(self.name)
@@ -185,7 +185,7 @@ def setup_class(cls):
185185
cls.expected_stats[0].append(stats)
186186
cls.expected_stats[1].append(stats)
187187
for key, dtype in vars.items():
188-
if dtype == np.bool:
188+
if dtype == bool:
189189
stats[key] = np.zeros(cls.draws, dtype=dtype)
190190
else:
191191
stats[key] = np.arange(cls.draws, dtype=dtype)

pymc3/tests/test_ndarray_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from pymc3.backends import base, ndarray
2222
from pymc3.tests import backend_fixtures as bf
2323

24-
STATS1 = [{"a": np.float64, "b": np.bool}]
24+
STATS1 = [{"a": np.float64, "b": bool}]
2525

2626
STATS2 = [
2727
{"a": np.float64},

0 commit comments

Comments
 (0)