Add new backends: stanr & stanli - #1911
Conversation
|
Whow! BTW... Stanli brings WALNUTS under the hood. Is that functionality also exported here? I have no clue how close this is to be merge ready for brms, but I must say I would be blown away if this makes it... and enables C++ free super fast sampling for (all?) brms models...a dream! |
Yep! For both the fit <- brm(time ~ age * sex, data = kidney, backend = 'stanli', engine = 'walnuts') |
|
Very cool, thank you! Quick question: do you transform the objects in to rstan::stanfit objects after fitting? My plan is to abandon the transformations and just store the fitted model objects of whatever backend we used (no transformation to stanfit anymore). however, this requires adding functions for parameter renaming and information extraction per backend rather than just rstan. So I am thinking (aloud with you right now) how to best approach this topic in light of the new backends that you propose to add. |
|
I added a big fix PR on @andrjohns's fork but now realise it's not actually in the code that changed. It's a small fix to make sure the right variables get included by brms after sampling with these alternative backends. Might not be needed if the post-processing changes. |
This PR adds support for two new backends:
stanrandstanli.The
stanrpackage is a new in-memory interface for Stan (a modernrstanalternative).stanruses broadly the same API ascmdstanr, so a lot of the existing machinery can be reused as-is.A much more exciting addition is the
stanlibackend! This uses the brilliantstanliproject by @seantalts to provide interpreted execution for Stan models - no compilation required!stanliinterop is provided by thestanrpackage using the same API as the normal compiled approach, so there's no additional maintenance/burden forbrmsWith this branch,
brmscan now be used with no c++ compilation/toolchain required!