-
Notifications
You must be signed in to change notification settings - Fork 33
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
stan model chunks #484
stan model chunks #484
Conversation
On the issue of navigating the code, can we use prefixes to differentiate between the stan code in |
This is how benchmark results would change (along with a 95% confidence interval in relative change) if dc29e32 is merged into main:
|
That turned out to be of no concern. |
calc sec
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 4470973 is merged into main:
|
So this is intentional in order to show which data chunks link with which function chunks etc? In the viewer I look at these from the tree structure of them being in folders then provides the distinction. Interesting to hear this isn't working out for you though. I would ideally like a solution that doesn't duplicate the info in the folder label in the filename though. |
Yeah, I feel the same way for all the reasons you mention. I think I would much prefer doing this manually (i.e having everything in chunks and then providing R code to generate the complete models (this would need to be done at build time/whenever the chunks were modified (likely in CI to be sure)). In this mists of time I did some work on this in a branch of The issue there would be how we maintain the code for generating the models of course... |
Isn't there also an issue that this would require management of between-snippet dependencies, inflating complexity? Unless perhaps we did away with functions. |
Hmm I'm not sure how much complexity it would really add to not duplicate functions? Or do you mean something more than this? |
Perhaps I'm misunderstanding what you're suggesting. If we compose a model of chunks then chunks will depend on other chunks (defining functions or declaring variables) which themselves might have dependencies. |
Yes but can't you define those in a list? We aren't saying we are going to have a system for composing models - just the models we already have? |
I think we concluded that this wasn't a good idea so I'm closing the PR. |
Testing whether we could move duplicated stan code into chunks.
I like the way it simplifies the main models and highlights commonalities. It also makes coding more fault tolerant.
On the other hand it will become even harder to trace code having to navigate, at times, to chunks that then call functions contained in other files. This could be mitigated by, e.g., making functions that are only called once chunks (e.g. the GP functions); or by moving each stan function into a separate files (though would complicate ensuring all relevant functions are loaded for all chunks) or all into one file.
In conclusion, I'm on the fence regarding whether this is a good idea. If going ahead with this there are a few bits of code that could potentially still be moved into chunks.
A few processing functions had to be updated in order to make this work. Also the stan code is probably less efficient in places - touchstone will tell us how much.
Closes #381