Best way to deal with computationally expensive posteriors

45 views
Skip to first unread message

Maryam Tajalli

unread,
Sep 23, 2021, 1:30:08 PM9/23/21
to emcee users
Hello everyone,

I am using emcee to sample the parameter space and my posterior function includes an inevitable for loop with an integral inside the loop, and it is basically very computationally expensive. Using scipy.integrate.quad inside the loop, the code takes almost 10 days to run. I have made use of other integration methods to speed up the calculations, but the results are not as accurate as in the case of scipy.integrate.quad, so I am looking for a solution to keep using quad but make the code run a lot faster.

I tried to parallelize the log_posterior function, however, I ran into the error: daemonic processes are not allowed to have children.

I am also considering writing my posterior function in C or Cython and wrap it into my Python code but I am not sure how much it will improve the performance of emcee, since scipy functions are already written in C/Fortran. 

I was wondering if anyone has any idea how I can speed up my code in this case. Any help is much appreciated!

Best,
Maryam.
Reply all
Reply to author
Forward
0 new messages