@@ -1612,6 +1612,8 @@ def pathfinder(
16121612 draws : Optional [int ] = None ,
16131613 num_single_draws : Optional [int ] = None ,
16141614 num_elbo_draws : Optional [int ] = None ,
1615+ psis_resample : bool = True ,
1616+ calculate_lp : bool = True ,
16151617 # arguments standard to all methods
16161618 seed : Optional [int ] = None ,
16171619 inits : Union [Dict [str , float ], float , str , os .PathLike , None ] = None ,
@@ -1645,6 +1647,14 @@ def pathfinder(
16451647
16461648 :param num_elbo_draws: Number of Monte Carlo draws to evaluate ELBO.
16471649
1650+ :param psis_resample: Whether or not to use Pareto Smoothed Importance
1651+ Sampling on the result of the individual Pathfinders. If False, the
1652+ result contains the draws from each path.
1653+
1654+ :param calculate_lp: Whether or not to calculate the log probability
1655+ for approximate draws. If False, this also implies that
1656+ ``psis_resample`` will be set to False.
1657+
16481658 :param seed: The seed for random number generator. Must be an integer
16491659 between 0 and 2^32 - 1. If unspecified,
16501660 :func:`numpy.random.default_rng` is used to generate a seed.
@@ -1726,12 +1736,22 @@ def pathfinder(
17261736 Research, 23(306), 1–49. Retrieved from
17271737 http://jmlr.org/papers/v23/21-0889.html
17281738 """
1729- if cmdstan_version_before (2 , 33 , self .exe_info ()):
1739+
1740+ exe_info = self .exe_info ()
1741+ if cmdstan_version_before (2 , 33 , exe_info ):
17301742 raise ValueError (
17311743 "Method 'pathfinder' not available for CmdStan versions "
17321744 "before 2.33"
17331745 )
17341746
1747+ if (not psis_resample or not calculate_lp ) and cmdstan_version_before (
1748+ 2 , 34 , exe_info
1749+ ):
1750+ raise ValueError (
1751+ "Arguments 'psis_resample' and 'calculate_lp' are only "
1752+ "available for CmdStan versions 2.34 and later"
1753+ )
1754+
17351755 if num_paths == 1 :
17361756 if num_single_draws is None :
17371757 num_single_draws = draws
@@ -1754,6 +1774,8 @@ def pathfinder(
17541774 max_lbfgs_iters = max_lbfgs_iters ,
17551775 num_draws = num_single_draws ,
17561776 num_elbo_draws = num_elbo_draws ,
1777+ psis_resample = psis_resample ,
1778+ calculate_lp = calculate_lp ,
17571779 )
17581780
17591781 with temp_single_json (data ) as _data , temp_inits (inits ) as _inits :
0 commit comments