1 #ifndef STAN_SERVICES_VARIATIONAL_PRINT_PROGRESS_HPP 2 #define STAN_SERVICES_VARIATIONAL_PRINT_PROGRESS_HPP 5 #include <stan/math/prim/scal.hpp> 14 namespace variational {
33 const std::string& prefix,
34 const std::string& suffix,
36 static const char*
function =
37 "stan::services::variational::print_progress";
39 stan::math::check_positive(
function,
40 "Total number of iterations",
42 stan::math::check_nonnegative(
function,
45 stan::math::check_positive(
function,
48 stan::math::check_positive(
function,
52 int it_print_width = std::ceil(std::log10(static_cast<double>(finish)));
53 if (
io::do_print(m - 1, (start + m == finish), refresh)) {
57 ss << std::setw(it_print_width) << m + start
59 ss <<
" [" << std::setw(3)
60 << (100 * (start + m)) / finish
62 ss << (tune ?
" (Adaptation)" :
" (Variational Inference)");
Probability, optimization and sampling library.
bool do_print(const int n, const bool special, const int refresh)
Indicates whether it should print on the current iteration.
base_writer is an abstract base class defining the interface for Stan writer callbacks.
void print_progress(int m, int start, int finish, int refresh, bool tune, const std::string &prefix, const std::string &suffix, interface_callbacks::writer::base_writer &writer)
Helper function for printing progress for variational inference.