Sample_ppc shape error with multi-index model

This appears to work beautifully. Thanks again!

with pm.Model() as model:
    
    # each of the styles gets its own sds for and b, 
    # shared across all weeks
    sd_a = pm.HalfNormal("sd_a", sd=2, shape=n_styles)
    sd_b = pm.HalfNormal("sd_b", sd=2, shape=n_styles)
    
    # each of the styles has a different probability p 
    # in each of the weeks
    a = pm.HalfNormal("a", sd=sd_a[style_idx], shape=(len(style_idx),))
    b = pm.HalfNormal("b", sd=sd_b[style_idx], shape=(len(style_idx),))
    
    style_probability = pm.Beta("style_probability", 
                                alpha=a[style_idx], 
                                beta=b[style_idx], shape=(len(style_idx),))
    
    style_demand_obs = pm.Binomial("style_demand", 
                                   n=demand, 
                                   p=style_probability, 
                                   observed=style_demand 
                                  )

Where all inputs are now flattened to 1D vectors.

1 Like