Closed dar326 closed 2 years ago
I was able to resolve this issue by making the prior on mu more flexible. This was necessary because the observed data for this model included non-adults. Closing this issue.
I ran into this error today and managed to fix it by changing the optimization algorithm used by find_MAP
( BFGS
instead of the default L-BFGS-B
). See https://github.com/ivanistheone/pymc_Rethinking_3/commit/9dc003f2a3336d774fc29fe008b0e67dcb3c6aaf
I chose BFGS
to match the algo used in the rethinking R package, cf. https://github.com/rmcelreath/rethinking/blob/f3ac8de0b4bcfabccc67ed033fb81d1873ec755e/R/map-quap.r#L26C50-L26C54
Hello,
Thank you for creating this library and making it available to the community. I have been working through Statistical Rethinking (2nd Edition) using PyMC3. In a desire to stay as true to the original R code base as possible, I have used your
quap
function wherever it is used in the original textbook R code. This has been working well for me overall but I have recently encountered an issue when callingquap
for a particular model in the book. This is a simple linear model that includes index variables to jointly model male and female heights from the Howell dataset (attached). The code to create the model is as follows:When approximating the posterior using
quap
, an error is generated from scipy during the construction of the underlying multivariate normal distribution that approximates the posterior. The error derives from the covariance matrix not being positive semi-definitive with the exact message being:I have confirmed that with the same dataset, the R code works as indicated in the textbook. I was wondering if you have any insight into what might be the difference in the implementation of
quap
from pym3-quap that might lead to this error? Alternatively, has this error previously been encountered and, if so, any suggestions on a workaround?I would appreciate any assistance you might be able to provide on this issue.
Best, Darryl