Open frankhezemans opened 6 months ago
Already done almost exactly like that as part of a big refactoring of the code I'm doing. This is legacy code from the original package, and my first goal was to get it to work ASAP, now onto doing exactly things like you suggested. There are many unnecessary if else clauses like that one, and also a lot of the code between chkpt_brms and chkp_stan is the same and can be abstracted away. Stay tuned for the next release :) and do post more if you have any other suggestions for features, I appreciate all feedback and requests!
Excellent, I'm looking forward to the next release!
This is just a minor suggestion to help simplify
chkpt_brms.R
(perhaps @venpopov you had already thought of it). You don't need a big if-else loop to separately runbrms::make_standata
andbrms::make_stancode
for the cases with or without threading (currently these lines).Instead, you can declare the number of threads,
num_threads
, to beNULL
if the input argumentthreads_per
was equal to one, and otherwise setnum_threads
tothreads_per
. After that, you can do one call tobrms::make_standata
andbrms::make_stancode
, both including the input argumentthreads = brms::threading(threads = num_threads)
. This is because callingbrms::threading
withthreads = NULL
is the default value, which will lead to no threading, as desired (see these and these lines).So something like this should do: