Extracting variable means from ADVI fitted model

In a PyMC3 model there is a property to map dict to array and vice versa under
model.bijection. A similar property is in the approximation class, for example, you can do:

    approx = pm.fit()
    # dict
    means_dict = approx.bij.rmap(approx.params[0].eval())
    # array
    sample_array = approx.bij.map(approx.sample(1))
2 Likes