Skip to content

Supress warning SMC initialization #5827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions pymc/smc/smc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import abc
import sys
import warnings

from abc import ABC
from typing import Dict, cast
Expand Down Expand Up @@ -175,12 +177,18 @@ def __init__(

def initialize_population(self) -> Dict[str, np.ndarray]:
"""Create an initial population from the prior distribution"""
result = sample_prior_predictive(
self.draws,
var_names=[v.name for v in self.model.unobserved_value_vars],
model=self.model,
return_inferencedata=False,
)
sys.stdout.write(" ") # see issue #5828
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore", category=UserWarning, message="The effect of Potentials"
)

result = sample_prior_predictive(
self.draws,
var_names=[v.name for v in self.model.unobserved_value_vars],
model=self.model,
return_inferencedata=False,
)
return cast(Dict[str, np.ndarray], result)

def _initialize_kernel(self):
Expand Down