Skip to content

Commit

Permalink
Revert Reff
Browse files Browse the repository at this point in the history
  • Loading branch information
tsivula committed Oct 31, 2017
1 parent bcf75ef commit cac66c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions m/psislw.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function [lw,kss] = psislw(lw,Reff)
%PSIS Pareto smoothed importance sampling
%
%
% Description
% [LW,K] = PSISLW(LW,Reff) returns log weights LW
% and Pareto tail indeces K, given log weights and optional arguments:
% Reff - relative MCMC efficiency N_eff/N
%
%
% Reference
% Aki Vehtari, Andrew Gelman and Jonah Gabry (2017). Pareto
% smoothed importance sampling. https://arxiv.org/abs/1507.02646v5
Expand All @@ -30,7 +30,7 @@
% Divide log weights into body and right tail
n=numel(x);
xs=sort(x);
xcutoff=xs(end-ceil(min(0.2*n,3*sqrt(n*Reff))));
xcutoff=xs(end-ceil(min(0.2*n,3*sqrt(n/Reff))));
if xcutoff<log(realmin)
% need to stay above realmin
xcutoff=-700;
Expand Down
2 changes: 1 addition & 1 deletion py/psis.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def psislw(lw, Reff=1.0, overwrite_lw=False):
kss = np.empty(m)

# precalculate constants
cutoff_ind = - int(np.ceil(min(0.2 * n, 3 * np.sqrt(n * Reff)))) - 1
cutoff_ind = - int(np.ceil(min(0.2 * n, 3 * np.sqrt(n / Reff)))) - 1
cutoffmin = np.log(np.finfo(float).tiny)
logn = np.log(n)
k_min = 1/3
Expand Down

0 comments on commit cac66c0

Please sign in to comment.