Classes | Functions
stan::variational Namespace Reference

Classes

class  advi
 
class  base_family
 
class  normal_fullrank
 
class  normal_meanfield
 

Functions

base_family operator+ (base_family lhs, const base_family &rhs)
 
base_family operator/ (base_family lhs, const base_family &rhs)
 
base_family operator+ (double scalar, base_family rhs)
 
base_family operator* (double scalar, base_family rhs)
 
normal_fullrank operator+ (normal_fullrank lhs, const normal_fullrank &rhs)
 
normal_fullrank operator/ (normal_fullrank lhs, const normal_fullrank &rhs)
 
normal_fullrank operator+ (double scalar, normal_fullrank rhs)
 
normal_fullrank operator* (double scalar, normal_fullrank rhs)
 
normal_meanfield operator+ (normal_meanfield lhs, const normal_meanfield &rhs)
 
normal_meanfield operator/ (normal_meanfield lhs, const normal_meanfield &rhs)
 
normal_meanfield operator+ (double scalar, normal_meanfield rhs)
 
normal_meanfield operator* (double scalar, normal_meanfield rhs)
 
void print_progress (int m, int start, int finish, int refresh, bool tune, const std::string &prefix, const std::string &suffix, callbacks::logger &logger)
 

Function Documentation

base_family stan::variational::operator* ( double  scalar,
base_family  rhs 
)
normal_meanfield stan::variational::operator* ( double  scalar,
normal_meanfield  rhs 
)
inline

Return a new approximation resulting from elementwise multiplication of the specified scalar to the mean and log standard deviation vectors of the specified approximation.

Parameters
[in]scalarScalar value
[in]rhsApproximation.
Returns
Multiplication of scalar by the specified approximation.

Definition at line 483 of file normal_meanfield.hpp.

483  {
484  return rhs *= scalar;
485  }
normal_fullrank stan::variational::operator* ( double  scalar,
normal_fullrank  rhs 
)
inline

Return a new approximation resulting from elementwise multiplication of the specified scalar to the mean and Cholesky factor of covariance entries for the specified approximation.

Parameters
[in]scalarScalar value
[in]rhsApproximation.
Returns
Multiplication of scalar by the specified approximation.

Definition at line 521 of file normal_fullrank.hpp.

521  {
522  return rhs *= scalar;
523  }
base_family stan::variational::operator+ ( base_family  lhs,
const base_family rhs 
)
base_family stan::variational::operator+ ( double  scalar,
base_family  rhs 
)
normal_meanfield stan::variational::operator+ ( normal_meanfield  lhs,
const normal_meanfield rhs 
)
inline

Return a new approximation resulting from adding the mean and log standard deviation of the specified approximations.

Parameters
[in]lhsFirst approximation.
[in]rhsSecond approximation.
Returns
Sum of the specified approximations.
Exceptions
std::domain_errorIf the dimensionalities do not match.

Definition at line 439 of file normal_meanfield.hpp.

440  {
441  return lhs += rhs;
442  }
normal_meanfield stan::variational::operator+ ( double  scalar,
normal_meanfield  rhs 
)
inline

Return a new approximation resulting from elementwise addition of the specified scalar to the mean and log standard deviation entries of the specified approximation.

Parameters
[in]scalarScalar value
[in]rhsApproximation.
Returns
Addition of scalar to specified approximation.

Definition at line 469 of file normal_meanfield.hpp.

469  {
470  return rhs += scalar;
471  }
normal_fullrank stan::variational::operator+ ( normal_fullrank  lhs,
const normal_fullrank rhs 
)
inline

Return a new approximation resulting from adding the mean and covariance matrix Cholesky factor of the specified approximations.

Parameters
[in]lhsFirst approximation.
[in]rhsSecond approximation.
Returns
Sum of the specified approximations.
Exceptions
std::domain_errorIf the dimensionalities do not match.

Definition at line 479 of file normal_fullrank.hpp.

479  {
480  return lhs += rhs;
481  }
normal_fullrank stan::variational::operator+ ( double  scalar,
normal_fullrank  rhs 
)
inline

Return a new approximation resulting from elementwise addition of the specified scalar to the mean and Cholesky factor of covariance entries for the specified approximation.

Parameters
[in]scalarScalar value
[in]rhsApproximation.
Returns
Addition of scalar to specified approximation.

Definition at line 507 of file normal_fullrank.hpp.

507  {
508  return rhs += scalar;
509  }
base_family stan::variational::operator/ ( base_family  lhs,
const base_family rhs 
)
normal_meanfield stan::variational::operator/ ( normal_meanfield  lhs,
const normal_meanfield rhs 
)
inline

Return a new approximation resulting from elementwise division of of the first specified approximation by the second.

Parameters
[in]lhsFirst approximation.
[in]rhsSecond approximation.
Returns
Elementwise division of the specified approximations.
Exceptions
std::domain_errorIf the dimensionalities do not match.

Definition at line 454 of file normal_meanfield.hpp.

455  {
456  return lhs /= rhs;
457  }
normal_fullrank stan::variational::operator/ ( normal_fullrank  lhs,
const normal_fullrank rhs 
)
inline

Return a new approximation resulting from elementwise division of of the first specified approximation by the second.

Parameters
[in]lhsFirst approximation.
[in]rhsSecond approximation.
Returns
Elementwise division of the specified approximations.
Exceptions
std::domain_errorIf the dimensionalities do not match.

Definition at line 493 of file normal_fullrank.hpp.

493  {
494  return lhs /= rhs;
495  }
void stan::variational::print_progress ( int  m,
int  start,
int  finish,
int  refresh,
bool  tune,
const std::string &  prefix,
const std::string &  suffix,
callbacks::logger logger 
)
inline

Helper function for printing progress for variational inference

Parameters
[in]mtotal number of iterations
[in]startstarting iteration
[in]finishfinal iteration
[in]refreshhow frequently we want to print an update
[in]tuneboolean indicates tuning vs. variational inference
[in]prefixprefix string
[in]suffixsuffix string
[in,out]loggerlogger

Definition at line 28 of file print_progress.hpp.

References stan::math::ceil(), stan::math::check_nonnegative(), stan::math::check_positive(), stan::callbacks::logger::info(), std::log10(), m, and ss.

Referenced by stan::variational::advi< stan_model, stan::variational::normal_meanfield, rng_t >::adapt_eta(), and TEST().

35  {
36  static const char* function =
37  "stan::variational::print_progress";
38 
40  "Total number of iterations",
41  m);
43  "Starting iteration",
44  start);
46  "Final iteration",
47  finish);
49  "Refresh rate",
50  refresh);
51 
52  int it_print_width = std::ceil(std::log10(static_cast<double>(finish)));
53  if (refresh > 0
54  && (start + m == finish || m - 1 == 0 || m % refresh == 0)) {
55  std::stringstream ss;
56  ss << prefix;
57  ss << "Iteration: ";
58  ss << std::setw(it_print_width) << m + start
59  << " / " << finish;
60  ss << " [" << std::setw(3)
61  << (100 * (start + m)) / finish
62  << "%] ";
63  ss << (tune ? " (Adaptation)" : " (Variational Inference)");
64  ss << suffix;
65  logger.info(ss);
66  }
67  }
Float_t ss
Definition: plot.C:24
void check_nonnegative(const char *function, const char *name, const T_y &y)
const XML_Char * prefix
Definition: expat.h:380
T log10(T number)
Definition: d0nt_math.hpp:120
void check_positive(const char *function, const char *name, const T_y &y)
void refresh()
Definition: show_event.C:21
fvar< T > ceil(const fvar< T > &x)
Definition: ceil.hpp:11