Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0035 pre model gqs #54

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

0035 pre model gqs #54

wants to merge 8 commits into from

Conversation

bob-carpenter
Copy link
Collaborator

This is ready to review.

I tried to flesh out how we'd actually code this and document it in the Reference Manual.

@WardBrian
Copy link
Member

designs/0035-pre-model-gqs.md Show resolved Hide resolved
designs/0035-pre-model-gqs.md Show resolved Hide resolved
designs/0035-pre-model-gqs.md Show resolved Hide resolved
designs/0035-pre-model-gqs.md Show resolved Hide resolved
designs/0035-pre-model-gqs.md Show resolved Hide resolved
designs/0035-pre-model-gqs.md Outdated Show resolved Hide resolved
designs/0035-pre-model-gqs.md Outdated Show resolved Hide resolved
designs/0035-pre-model-gqs.md Show resolved Hide resolved
designs/0035-pre-model-gqs.md Outdated Show resolved Hide resolved
designs/0035-pre-model-gqs.md Show resolved Hide resolved
@bob-carpenter
Copy link
Collaborator Author

@WardBrian and @SteveBronder and @nhuurre:

I think I've addressed all the issues in this if you'd like to take another look.

Thanks.

Copy link
Member

@WardBrian WardBrian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments on the implementation end (I am leaving the motivation and mathematical discussions to others who know better...)

### Program Blocks for latent data

The latent data block appears after the transformed parameters block
but before the odel block. Like the parameters, transformed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
but before the odel block. Like the parameters, transformed
but before the model block. Like the parameters, transformed

Comment on lines +461 to +464
As with blocks other than the parameters block, any constraints on the
declared variables will be checked at the end of the block and an
exception will be raised if they are violated, which will cause the
current iteration in any of the algorithms to be rejected.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true for generated quantities, which is filled with NaN rather than causing a rejection, and model can't have constraints, so it's probably worth only saying "As with the transformed parameters block".

stan::model::model_base&
new_model(stan::io::var_context& data_context, unsigned int seed,
std::ostream* msg_stream);
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indentation is breaking the rendering of the rest of the following text


```cpp
struct latent_data : public latent_data_base_crtp<latent_data> {
int iteration_number__; // included by default in all latent_data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a few of these iteration_number__ are hanging around -- was the intention to remove them entirely, or just from the user-facing portion of this proposal?

Comment on lines +665 to +666
this can be implemented inthe `latent_data_base_crtp` class using the
CRTP.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the latent date class needs a base or any CRTP usage, the model class would be the thing that contains the set function

Comment on lines +704 to +705
virtual void write_variable_names(std::vector<string>& names) const = 0;
virtual void write_variable_values(std::vector<double>& values) const = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather these be part of the existing model class functions.

In particular, I think it would be useful in terms of minimizing the amount of new code gen that existing models (which by definition don't use this block) would have under a updated compiler

Comment on lines +722 to +723
template <bool propto__, bool jacobian__, typename T_> inline T_
log_prob(Eigen::Matrix<T_,-1,1>& params_r,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two signatures contradict the above (auto log_prob(stan::math::allocator& alloc, ...) {)

We may want to be somewhat nonspecific in the design doc and just say "log_prob will need an additional argument" without specifying right now what the type of that argument will be

Comment on lines +750 to +751
The existing `write_array` method must be similarly updated, because
now it is going to need to write the generated data.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I prefer to the above suggestion of a write_variable_values function on a latent-data-specific base class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants