-
Notifications
You must be signed in to change notification settings - Fork 8
Remove Model and rewrite turing_model
#45
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
Conversation
d40f9d0 to
fd5512f
Compare
| predictors=size(X, 2), | ||
| idxs=idxs, | ||
| n_gr=n_gr, | ||
| intercept_ranef=intercept_ranef, | ||
| μ_X=μ_X, | ||
| σ_X=σ_X, | ||
| prior=prior, | ||
| residual=1 / std(y), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these arguments depend on y and X dynamically whereas others are fixed - is this intended? I assume this will be problematic if you reinstantiate the model with new data since then some of the arguments are not synced anymore.
Why do you include all of these arguments in the first place? Do you ever plan to update y or X or change any of the keyword arguments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great point David. I didn't preview updates on the data. My main focus was to have the user API to be the simplest as possible. We can change it if necessary. My main idea was to mirror rstanarm/brms default priors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main focus was to have the user API to be the simplest as possible. We can change it if necessary. My main idea was to mirror rstanarm/brms default priors.
Isn't it simpler to just use model(y, X)? It's still not clear to me why/how these goals imply that you want to use keyword arguments here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right, we can probably move these keywords to the body of the function. We might just keep prior then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might just keep prior then.
Because users should be able to call the model with a different prior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And standardize also, forgot that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
Another observation: It seems mu_X and sigma_X are not used at all in the models, and there are issues with undefined variables due to the isempty(intercept_ranef) checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And
standardizealso, forgot that.
standardize is not part of the model keyword arguments. Maybe you are referring (also for the priors?) to turing_model? I focused only on the Turing model that this function creates, and the keyword arguments that are currently defined for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
standardizeis not part of the model keyword arguments. Maybe you are referring (also for the priors?) toturing_model?
yes, you are correct. I've made a mess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great PR! Thanks!
One comment: Why not change all Gaussian to Normal?
EDIT: I think I got all Gaussians in the PR changes, but might be worth to have a double check.
Because I assumed you prefer the name |
|
I prefer, but for our target user might be daunting. I think they would prefer I only used |
Co-authored-by: Jose Storopoli <[email protected]>
rikhuijzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff, David 👍 👍
storopoli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to merge, go ahead. We can address the isempty(intercept_ranef) checks in another PR.
|
Thanks for the nice improvements, @devmotion. It’ll be great if we can track performance regression for TuringGLM (e.g. using a notebook similar to tutorials), but that can be done in a separate PR. |
You mean by reporting allocations like in something like fonsp/Pluto.jl#1959? Note that that PR is about compilation time, but runtime could be following a similar procedure. Reporting CPU time doesn't make sense because GitHub Runners run on different CPUs. |
|
Also, we are not doing anything special on TuringGLM.jl we just call Turing.jl under the hood. The overhead might be negligible. |
I have many more changes in a local branch but I guess it is cleaner to open a separate PR and do not modify the implementation of the Turing models in this PR. |
That's right. However, the performance of
That's correct - not quite sure how to automate performance tracking. |
This makes total sense! Yes, now I get it. I've asked @rikhuijzer to help us with this since he is pretty good on that. |
This PR implements some of the discussion in #44 and simplifies
turing_model.It also fixes a bug in the current implementation: Currently,
turing_model(formula, data; model=M, ...)always returns a model with a Gaussian likelihood, regardless ofM.