You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add proper type hints throughout pathfinder module
- Improve error handling in concurrent execution paths
- Better handling of when all paths are fail by displaying results before Assertion
- Changed Australian English spelling to US
- Update compile_pymc usage to handle deprecation warning
- Add tests for concurrent execution and seed reproducibility
- Clean up imports and remove redundant code
- Improve docstrings and error messages
This implements the Pareto Smooth Importance Resampling (PSIR) method, as described in Algorithm 5 of Zhang et al. (2022). The PSIR follows a similar approach to Algorithm 1 PSIS diagnostic from Yao et al., (2018). However, before computing the the importance ratio r_s, the logP and logQ are adjusted to account for the number multiple estimators (or paths). The process involves resampling from the original sample with replacement, with probabilities proportional to the computed importance weights from PSIS.
36
36
@@ -50,8 +50,8 @@ def importance_sampling(
50
50
51
51
Returns
52
52
-------
53
-
NDArray
54
-
importance sampled draws
53
+
ImportanceSamplingResult
54
+
importance sampled draws and other info based on the specified method
55
55
56
56
Future work!
57
57
----------
@@ -68,14 +68,14 @@ def importance_sampling(
68
68
Zhang, L., Carpenter, B., Gelman, A., & Vehtari, A. (2022). Pathfinder: Parallel quasi-Newton variational inference. Journal of Machine Learning Research, 23(306), 1-49.
69
69
"""
70
70
71
-
warning_msgs= []
71
+
warnings= []
72
72
num_paths, _, N=samples.shape
73
73
74
74
ifmethod=="none":
75
-
warning_msgs.append(
75
+
warnings.append(
76
76
"Importance sampling is disabled. The samples are returned as is which may include samples from failed paths with non-finite logP or logQ values. It is recommended to use importance_sampling='psis' for better stability."
0 commit comments