drbenvincent / darc_toolbox

Run adaptive decision making experiments
MIT License
16 stars 2 forks source link

export plot of posterior distributions over parameters #4

Closed drbenvincent closed 6 years ago

drbenvincent commented 6 years ago

I'm not sure if this will remain a feature or not, but in the mean time, it is useful to diagnose the various models in construction.

BUG: PsychoPy is throwing an error when we try to access the keys of model.θ or model.prior. It seems to not like keys which are unicode characters. So either get to the bottom of this, or just use non-unicode for parameter names.

drbenvincent commented 6 years ago

works with something like this

import matplotlib.pyplot as plt
n_params = len(model.prior) # note, psychopy errors if we as for len(model.θ)
fig, axes = plt.subplots(1, n_params, figsize=(9, 4), tight_layout=True)
for (axis, key) in zip(axes, model.θ.keys()):
    axis.hist(model.θ[key], 50, normed=1, facecolor='green', alpha=0.75)
    axis.set_xlabel(key)
plt.savefig(filename+'_parameter_plot.pdf')
drbenvincent commented 6 years ago

this is now a method in the model class