arviz-devs / arviz

Exploratory analysis of Bayesian models with Python
https://python.arviz.org
Apache License 2.0
1.61k stars 407 forks source link

Variable order in forestplot and traceplot #568

Closed denadai2 closed 5 years ago

denadai2 commented 5 years ago

I am using pystan to fit a multi-variate regression where y ~ Xb + a, and X is a n x p matrix.

Using arviz I plot the traces and the forestplot.

data = az.from_pystan(posterior=fit,
                      observed_data=['y'],
                      log_likelihood='log_lik',
                      posterior_predictive='y_pred',
                      coords={'features': features},
                      dims={'b': ['features']})

# RESULTS
model_name = make_model_name(args)

print("PLOTTING")
az.plot_trace(data, var_names=['b', 'a'])

However, the order of names of b (store in features) in the plot is never the same when I run the fit multiple times. How can impose it? Shouldn't the library impose an order?

Thanks

ahartikainen commented 5 years ago

I think this is duplicate of this https://github.com/arviz-devs/arviz/issues/554

Current master has fixed the problem.

Still, thanks for reporting the bug.

denadai2 commented 5 years ago

ahah nice, I'm too slow :P