-
-
Notifications
You must be signed in to change notification settings - Fork 204
Prototype for set_inits() #1646
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
base: master
Are you sure you want to change the base?
Conversation
- works with Intercept and b for all distributional parameters - does not work with random effects and special parameters - tests for helper functions and local test for brm with set_inits
|
This is a great addition to But, I also saw that @venpopov included a |
|
Thank you a lot @venpopov! Currently, I am a bit overwhelmed with things so it may take a while until I get back to this issue. But I highly appreciate your work and I am confident it will provide a good basis for making this feature work generally for any kinds of brms models. |
|
I understand. Should I keep working on this if I want to add things, or would you prefer me to leave it as is until you get a chance to look over it? |
|
I don't know yet. let me think about it
Ven Popov ***@***.***> schrieb am Sa., 13. Apr. 2024, 13:32:
… I understand. Should I keep working on this if I want to add things, or
would you prefer me to leave it as is until you get a chance to look over
it?
—
Reply to this email directly, view it on GitHub
<#1646 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADCW2AEFYORGS6RYVZ42ONTY5EJVTAVCNFSM6AAAAABGCROVFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJTGYYTSOJXGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
I like the general outline of the functionality. Especially the user interface is very pretty I think. As for the par_info. Perhaps we can abstract the functionality of mapping to the Stan parameters to be reusable for both priors (stan code generation) and setting inits. If we just copy the relevant code, I worry this will become hard to maintain with new terms being potentially added in the future. I will think about it a bit more. |
|
Glad you like the general design! I totally agree we should abstract/refactor common functionality - to make it easier to maintain, less error prone, allow for easier future extension. I didn't do it in the prototype because I wanted to make something simple that works without messing around and potentially breaking the existing code. But we are on the same page about the need for abstraction. I just saw your email, will respond there in a bit |
|
A brief summary of what we discussed. par_info:
quality control:
UI:
|
|
Just a quick update from my side - unfortunately I didn't find the time to work on this and I'll be on vacation for 2 weeks. I'll get back to it when I come back |
|
Hi @venpopov and @paul-buerkner I wanted to check in, if there is any progress with this issue, as I am currently working on implementing some evidence accumulation models in the As @venpopov mentioned in an earlier post, in principle I could write a custom If this issue is currently not high on the priority list, then I will check what it would take to write such a function. But if there is a chance that you would look into this at some point in the next 6 to 8 weeks, then I would rather wait on a more general implementation in Also, if there is anything that I could do and help with this issues, feel free to tell me. Then I will see how much it would take me to look into the changes proposed by @venpopov and then help getting this issue closed. |
As discussed in #1645, here is a prototype for a
set_inits()function modeled afterset_prior()Here's a functioning example, setting inits on
Interceptandb_sigma:Created on 2024-04-11 with reprex v2.1.0
Implementation
set_inits()takes arguments following theset_prior()syntax and creates a data.frame of classbrmsinitsset_inits()can be added together just like forset_prior()brm()there is now the following piece of new code:which calls
.inits_fun()internal function to generate a list of inits from the specification of thebrmsinitsobject.inits_fun()takes as argument the brmsinits object, the bterms object, the data and the standatapar_info()which generates lists of type:by using some of the code from
stan_predictorLimitations and generalization
This currently only works for the
Interceptandbtype parameters for all population parameters and families. It does not work for random effectssdand for thezvector. This is where I would appreciate your help to generalize this (the current code uses a par_info_fe() function to generate the information for the fixed effects. Similar functions would be needed for the random effects and other special parametersTests
I added tests for all the internal helper functions, and also a test for
brmwith set_inits() in thetests/localfolderAdditional features
Would be nice to have
staninits, which takes the formula, data and set_inits and generates the inits listconstant(x)syntax as for the priordefault_inits, similar todefault_prior, which shows the structure of how to specify inits for the valid parameters. the default values themselves are nto very informative - uniform(-2,2) on the unconstained scale, but the point is to see which parameters you can specify inits for