Skip to content

Commit

Permalink
Round Pareto-K value
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Apr 12, 2024
1 parent a133e1d commit eb2dffc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/stan/services/pathfinder/psis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <stan/callbacks/logger.hpp>
#include <stan/services/error_codes.hpp>
#include <tbb/parallel_invoke.h>
#include <iomanip>
#include <sstream>

namespace stan {
namespace services {
Expand Down Expand Up @@ -261,10 +263,13 @@ inline Eigen::Array<double, Eigen::Dynamic, 1> psis_weights(
llr_weights.coeffRef(idx.coeff(i)) = smoothed.first.coeff(i);
}
if (smoothed.second > 0.7) {
logger.warn(std::string("Pareto k value (") +
std::to_string(smoothed.second) + ") is greater than 0.7."
" Importance resampling was not able to improve the approximation,"
" which may indicate that the approximation itself is poor.");
std::stringstream s;
s << "Pareto k value (" << std::setprecision(2) << smoothed.second
<< ") is greater than 0.7. Importance resampling was not able to "
<< "improve the approximation, which may indicate that the "
<< "approximation itself is poor.";

logger.warn(s.str());
}
}
}
Expand Down

0 comments on commit eb2dffc

Please sign in to comment.