Open alashworth opened 5 years ago
Comment by wds15 Tuesday Nov 07, 2017 at 10:27 GMT
This sounds like a great thing! If possible, the design should take into account that multiple generated quantities blocks can be defined by the user. As a bonus the user should be able to select which of these blocks get executed. Sorry for jumping ahead...do we have such a ticket already or should I open one and we link it to this issue?
Comment by bob-carpenter Tuesday Nov 07, 2017 at 14:43 GMT
On Nov 7, 2017, at 5:27 AM, wds15 notifications@github.com wrote:
This sounds like a great thing! If possible, the design should take into account that multiple generated quantities blocks can be defined by the user. As a bonus the user should be able to select which of these blocks get executed. Sorry for jumping ahead...do we have such a ticket already or should I open one and we link it to this issue?
For the initial implementation, we won't be changing the language to allow multiple generated quantities blocks.
Feel free to create an issue with an enhancement to this feature. If you do, you should say how multiple blocks get selected and what the new Stan language would look like.
Comment by mitzimorris Tuesday Nov 07, 2017 at 14:51 GMT
the current implementation for this feature is on branch https://github.com/stan-dev/stan/tree/feature/2432-standalone-gq-service
in implementing this, I found a couple of bugs in the generated code. the generated methods write_array
, unconstrained_param_names
, and constrained_param_names
have args bool include_tparams__
and bool include_gqs__
. when tparams__
is false and include_gqs__
is true, the currently generated code won't write out the generated quantities values.
regarding the above feature request for multiple generated quantities blocks, this introduces new sources of confusion w/r/t how any set of results were obtained. a much simpler approach would be to keep parallel models with different generated quantities blocks and run them as needed.
Comment by mitzimorris Thursday Nov 09, 2017 at 19:19 GMT
@bob-carpenter - are these initial comments in the code still valid?
// TODO(carpenter): see if params_i can be static w.r.t. Google style:
// https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables
// TODO(carpenter): add refresh
Comment by bob-carpenter Thursday Nov 09, 2017 at 19:51 GMT
@mitzimorris: Yes, but they don't have to be addressed right away.
@seantalts is only enforcing formatting, not semantics, so a static constant should be OK here; or feel free to leave the less efficient version in---it's not a big deal here at all; this was more about me trying to figure out what Google doesn't like about static constants within functions as it's now the standard way to implement singletons in C++11.
If you add refresh, you'll need to add some output that lets users know what iteration they're on; up to you if you want to do this as part of this pull request. The consensus seemed to be this would go fast enough that it's not a concern.
Comment by wds15 Saturday Nov 11, 2017 at 17:51 GMT
Thinking about it, I would suggest that we implement different predictive checks with tools we already have. So I imagine, one can get different predictive checks by multiple Stan files which include the right stuff from some common source. Should things work as I expect, then the user can have different generated quantities blocks with this easily.
The simplest approach would be to have a Stan model without any generated quantities block and then for each predictive check the user creates a new file which just includes the base Stan model and adds a generated quantities block.
I hope this works with what is being put up here, but I guess it should.
Issue by bob-carpenter Monday Nov 06, 2017 at 17:26 GMT Originally opened as https://github.com/stan-dev/stan/issues/2432
Summary:
Something to take in existing draws and produce generated quantities and transformed parameters.
Description:
We need a new object
services::util::generated_quantities_writer
that will let write the header for just the generated quantities.Current Version:
v2.17.0