Skip to content

Commit 2f22c1a

Browse files
committed
supress warning SMC initialization
1 parent 5703a9d commit 2f22c1a

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

pymc/smc/smc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from abc import ABC
1717
from typing import Dict, cast
18+
import warnings
1819

1920
import aesara.tensor as at
2021
import numpy as np
@@ -175,12 +176,18 @@ def __init__(
175176

176177
def initialize_population(self) -> Dict[str, np.ndarray]:
177178
"""Create an initial population from the prior distribution"""
178-
result = sample_prior_predictive(
179-
self.draws,
180-
var_names=[v.name for v in self.model.unobserved_value_vars],
181-
model=self.model,
182-
return_inferencedata=False,
183-
)
179+
print()
180+
with warnings.catch_warnings():
181+
warnings.filterwarnings(
182+
"ignore", category=UserWarning, message="The effect of Potentials"
183+
)
184+
185+
result = sample_prior_predictive(
186+
self.draws,
187+
var_names=[v.name for v in self.model.unobserved_value_vars],
188+
model=self.model,
189+
return_inferencedata=False,
190+
)
184191
return cast(Dict[str, np.ndarray], result)
185192

186193
def _initialize_kernel(self):

0 commit comments

Comments
 (0)