Hi @omrihar.
My Yoda-like recommendation (to maximise learning) would be to try to implement the simplest model you can (e.g. no hierarchy, one predictor variable). Once you’ve got that working, it is much easier to make tiny jumps in complexity to achieve the model you want.
size and class order are mixed up here
coords = {
'size': df.VehicleClass.cat.categories,
'class': df.VehicleSize.cat.categories,
'models': df.Model.cat.categories,
}
This line indicates that you’d probably benefit from taking a look at the way how indexing is done in other models
α_model = pm.Normal("α_model", α_class[class_to_model[class_codes]] + ...)
The pseudocode could perhaps do with a bit more thinking about… everything in there apart from exposure and σ_model is a prior, and I suspect that the data needs to make more of an appearance.
α_class ~ Normal(0, 0.3)
α_size ~ Normal(0, 0.3)
α_model ~ Normal(α_class + α_size, σ_model)
ln(μ) = α_model + offset(ln(exposure))
claims ~ Poisson(μ)
Hope this might be of some use?