|
| | prob_grad (size_t num_params_r) |
| |
| | prob_grad (size_t num_params_r, std::vector< std::pair< int, int > > ¶m_ranges_i) |
| |
| virtual | ~prob_grad () |
| |
| void | set_num_params_r (size_t num_params_r) |
| |
| void | setparam_ranges_i__ (std::vector< std::pair< int, int > > param_ranges_i) |
| |
| virtual size_t | num_params_r () |
| |
| virtual size_t | num_params_i () |
| |
| std::pair< int, int > | param_range_i (size_t idx) |
| |
| void | set_param_range_i_lower (size_t idx, int low) |
| |
| void | set_param_range_i_upper (size_t idx, int up) |
| |
| int | param_range_i_lower (size_t idx) |
| |
| int | param_range_i_upper (size_t idx) |
| |
| virtual void | init (std::vector< double > ¶ms_r, std::vector< int > ¶ms_i) |
| |
| virtual double | grad_log_prob (std::vector< double > ¶ms_r, std::vector< int > ¶ms_i, std::vector< double > &gradient, std::ostream *output_stream=0)=0 |
| |
| virtual double | log_prob (std::vector< double > ¶ms_r, std::vector< int > ¶ms_i, std::ostream *output_stream=0)=0 |
| |
| virtual double | grad_hess_log_prob (std::vector< double > ¶ms_r, std::vector< int > ¶ms_i, std::vector< double > &gradient, std::vector< double > &hessian, std::ostream *output_stream=0) |
| | Evaluate the log-probability, its gradient, and its Hessian at params_r. More...
|
| |
| virtual double | log_prob_star (size_t idx, int val, std::vector< double > ¶ms_r, std::vector< int > ¶ms_i, std::ostream *output_stream=0) |
| |
| virtual void | write_csv (std::vector< double > ¶ms_r, std::vector< int > ¶ms_i, std::ostream &o, std::ostream *output_stream=0) |
| | Write the parameters on a single line in CSV format. More...
|
| |
| void | finite_diff_grad (std::vector< double > ¶ms_r, std::vector< int > ¶ms_i, std::vector< double > &grad, double epsilon=1e-6, std::ostream *output_stream=0) |
| | Compute the gradient using finite differences for the specified parameters, writing the result into the specified gradient, using the specified perturbation. More...
|
| |
| int | test_gradients (std::vector< double > ¶ms_r, std::vector< int > ¶ms_i, double epsilon=1e-6, double error=1e-6, std::ostream &o=std::cout, std::ostream *output_stream=0) |
| | Test the grad_log_prob() function's ability to produce accurate gradients using finite differences. More...
|
| |
The prob_grad class represents densities with fixed numbers of discrete and scalar parameters and the gradient with respet to the scalar parameters.
Definition at line 24 of file prob_grad.hpp.
| virtual double stan::model::prob_grad::grad_hess_log_prob |
( |
std::vector< double > & |
params_r, |
|
|
std::vector< int > & |
params_i, |
|
|
std::vector< double > & |
gradient, |
|
|
std::vector< double > & |
hessian, |
|
|
std::ostream * |
output_stream = 0 |
|
) |
| |
|
inlinevirtual |
Evaluate the log-probability, its gradient, and its Hessian at params_r.
This default version computes the Hessian numerically by finite-differencing the gradient, at a cost of O(params_r.size()^2).
- Parameters
-
| params_r | Real-valued parameter vector. |
| params_i | Integer-valued parameter vector. |
| gradient | Vector to write gradient to. |
| hessian | Vector to write gradient to. hessian[i*D + j] gives the element at the ith row and jth column of the Hessian (where D=params_r.size()). |
| output_stream | Stream to which print statements in Stan programs are written, default is 0 |
Definition at line 112 of file prob_grad.hpp.