Help with setting up a hierarchical GLM model

Hi @drbenvincent,

thanks for replying! I did build much smaller models and am able to fit them very well. I’m now experimenting with this more complex one and I find it quite hard to explain exactly what I’m after, even though in my mind it is pretty clear.
In most of the examples I saw, usually the hyper-priors all come from the same grouping, in which case the indexing is straightforward. Here, however, because I want to include multiple hyperpriors with different dimensionality I’m getting a semi brain-melt.

Now, however, I think I may have figured it out. Since there is a unique mapping model → size and model → class, I just need to build a smaller dataframe with one instance of model per row, then when I create the priors for model, use this mapping instead of my large training set.

I find that I have been struggling quite a lot to understand the vectorization processes in pymc, in comparison with Turing.jl or Stan, where a simple for loop to build the likelihood is much easier to program.

Having said that, I prefer to use pymc and python since it’s my current native programming language, and it is much easier to install on cloud compute instances such as databricks than stan, which is why I make a point of trying to build arbitrarily complex bespoke models in pymc…

I’ll report back if/when I figure this out :slight_smile: