Skip to content

Commit f09e934

Browse files
committed
update docs and cleanup signatures for laplace. Put internal functions in internal namespace
1 parent 27684f8 commit f09e934

15 files changed

Lines changed: 450 additions & 713 deletions

doxygen/doxygen.cfg

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,3 +2741,38 @@ MSCGEN_TOOL =
27412741
# command).
27422742

27432743
MSCFILE_DIRS =
2744+
2745+
ALIASES += laplace_options="\
2746+
\param[in] tolerance controls the convergence criterion when finding the mode in the Laplace approximation. \
2747+
\param[in] max_num_steps maximum number of steps before the Newton solver breaks and returns an error. \
2748+
\param[in] hessian_block_size Block size of Hessian of log likelihood w.r.t latent Gaussian variable theta. \
2749+
\param[in] solver Type of Newton solver. Each corresponds to a distinct choice of B matrix (i.e. application SWM formula): \
2750+
1. computes square-root of negative Hessian. \
2751+
2. computes square-root of covariance matrix. \
2752+
3. computes no square-root and uses LU decomposition. \
2753+
\param[in] max_steps_line_search Number of steps after which the algorithm gives up on doing a line search. If 0, no linesearch. \
2754+
"
2755+
2756+
ALIASES += laplace_common_template_args="\
2757+
\tparam ThetaVec A type inheriting from `Eigen::EigenBase` with dynamic sized rows and 1 column. \
2758+
\tparam CovarFun A functor with an `operator()(CovarArgsElements..., {TrainTupleElements...| PredTupleElements...})` \
2759+
method. The `operator()` method should accept as arguments the \
2760+
inner elements of `CovarArgs`. The return type of the `operator()` method \
2761+
should be a type inheriting from `Eigen::EigenBase` with dynamic sized \
2762+
rows and columns. \
2763+
\tparam CovarArgs A tuple of types to passed as the first arguments of `CovarFun::operator()`\
2764+
"
2765+
2766+
ALIASES += laplace_common_args="\
2767+
\param[in] theta_0 the initial guess for the Laplace approximation. \
2768+
\param[in] covariance_function a function which returns the prior covariance. \
2769+
\param[in] covar_args arguments for the covariance function. \
2770+
"
2771+
2772+
ALIASES += msg_arg="\
2773+
\param[in, out] msgs stream for messages from likelihood and covariance \
2774+
"
2775+
2776+
ALIASES += rng_arg="\
2777+
\param[in, out] rng Random number generator \
2778+
"

stan/math/mix/functor/laplace_base_rng.hpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,14 @@ namespace math {
2222
* To sample the "original" theta's, set pred_tuple = train_tuple.
2323
* @tparam LLFunc Type of likelihood function.
2424
* @tparam LLArgs Tuple of arguments types of likelihood function.
25-
* @tparam ThetaVec A type inheriting from `Eigen::EigenBase` with dynamic
26-
* sized rows and 1 column.
27-
* @tparam CovarFun A functor with an
28-
* `operator()(CovarArgsElements..., {TrainTupleElements...|
29-
PredTupleElements...})`
30-
* method. The `operator()` method should accept as arguments the
31-
* inner elements of `CovarArgs`. The return type of the `operator()` method
32-
* should be a type inheriting from `Eigen::EigenBase` with dynamic sized
33-
* rows and columns.
25+
* \laplace_common_template_args
3426
* @tparam RNG A valid boost rng type
35-
* @tparam CovarArgs A tuple of types to passed as the first arguments of
36-
`CovarFun::operator()`
3727
* @param ll_fun Likelihood function.
3828
* @param ll_args Arguments for likelihood function.
39-
* @param theta_0 Initial guess for finding the mode of the conditional
40-
pi(theta_pred | y, phi, x_pred).
41-
* @param covariance_function Covariance function.
42-
* @param covar_args Observed/training covariates for covariance function.
29+
* \laplace_common_args
4330
* @param options Control parameter for optimizer underlying Laplace approx.
44-
* @param rng Rng number.
45-
* @param msgs Stream for function prints.
31+
* \rng_arg
32+
* \msg_arg
4633
*/
4734
template <
4835
typename LLFunc, typename LLArgs, typename ThetaVec, typename CovarFun,
@@ -54,7 +41,7 @@ inline Eigen::VectorXd laplace_base_rng(LLFunc&& ll_fun, LLArgs&& ll_args,
5441
CovarArgs&& covar_args,
5542
const laplace_options& options,
5643
RNG& rng, std::ostream* msgs) {
57-
auto md_est = laplace_marginal_density_est(
44+
auto md_est = internal::laplace_marginal_density_est(
5845
ll_fun, std::forward<LLArgs>(ll_args), std::forward<ThetaVec>(theta_0),
5946
std::forward<CovarFun>(covariance_function),
6047
to_ref(std::forward<CovarArgs>(covar_args)), options, msgs);

0 commit comments

Comments
 (0)