@@ -480,6 +480,7 @@ def sample(
480
480
" complications in your downstream analysis. Please consider to switch to `InferenceData`:\n "
481
481
"`pm.sample(..., return_inferencedata=True)`" ,
482
482
UserWarning ,
483
+ stacklevel = 2 ,
483
484
)
484
485
485
486
if return_inferencedata is None :
@@ -614,6 +615,7 @@ def sample(
614
615
"DEMetropolis should be used with more chains than dimensions! "
615
616
"(The model has {} dimensions.)" .format (initial_point_model_size ),
616
617
UserWarning ,
618
+ stacklevel = 2 ,
617
619
)
618
620
_print_step_hierarchy (step )
619
621
trace = _sample_population (parallelize = cores > 1 , ** sample_args )
@@ -666,7 +668,9 @@ def sample(
666
668
667
669
if compute_convergence_checks :
668
670
if draws - tune < 100 :
669
- warnings .warn ("The number of samples is too small to check convergence reliably." )
671
+ warnings .warn (
672
+ "The number of samples is too small to check convergence reliably." , stacklevel = 2
673
+ )
670
674
else :
671
675
trace .report ._run_convergence_checks (idata , model )
672
676
trace .report ._log_summary ()
@@ -1664,7 +1668,8 @@ def sample_posterior_predictive(
1664
1668
warnings .warn (
1665
1669
"samples parameter is smaller than nchains times ndraws, some draws "
1666
1670
"and/or chains may not be represented in the returned posterior "
1667
- "predictive sample"
1671
+ "predictive sample" ,
1672
+ stacklevel = 2 ,
1668
1673
)
1669
1674
1670
1675
model = modelcontext (model )
@@ -1674,6 +1679,7 @@ def sample_posterior_predictive(
1674
1679
"The effect of Potentials on other parameters is ignored during posterior predictive sampling. "
1675
1680
"This is likely to lead to invalid or biased predictive samples." ,
1676
1681
UserWarning ,
1682
+ stacklevel = 2 ,
1677
1683
)
1678
1684
1679
1685
if var_names is not None :
@@ -1829,6 +1835,7 @@ def sample_posterior_predictive_w(
1829
1835
"The effect of Potentials on other parameters is ignored during posterior predictive sampling. "
1830
1836
"This is likely to lead to invalid or biased predictive samples." ,
1831
1837
UserWarning ,
1838
+ stacklevel = 2 ,
1832
1839
)
1833
1840
break
1834
1841
@@ -1952,6 +1959,7 @@ def sample_prior_predictive(
1952
1959
"The effect of Potentials on other parameters is ignored during prior predictive sampling. "
1953
1960
"This is likely to lead to invalid or biased predictive samples." ,
1954
1961
UserWarning ,
1962
+ stacklevel = 2 ,
1955
1963
)
1956
1964
1957
1965
if var_names is None :
0 commit comments