Skip to content

Commit 26f884b

Browse files
Add StatsBijection.n_samplers property
1 parent 31c30dc commit 26f884b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pymc/step_methods/compound.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ def __init__(self, sampler_stats_dtypes: Sequence[Mapping[str, type]]) -> None:
187187
for s, names_dtypes in enumerate(sampler_stats_dtypes)
188188
]
189189

190+
@property
191+
def n_samplers(self) -> int:
192+
return len(self._stat_groups)
193+
190194
def map(self, stats_list: Sequence[Mapping[str, Any]]) -> StatsDict:
191195
"""Combine stats dicts of multiple samplers into one dict."""
192196
stats_dict = {}

pymc/tests/step_methods/test_compound.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def test_stats_bijection(self):
116116
{"a": float, "c": int},
117117
]
118118
bij = StatsBijection(step_stats_dtypes)
119+
assert bij.n_samplers == 2
119120
stats_l = [
120121
dict(a=1.5, b=3),
121122
dict(a=2.5, c=4),

0 commit comments

Comments
 (0)