plot_posterior_predictive

244 views
Skip to first unread message

Carina Forster

unread,
Apr 6, 2021, 7:24:03 AM4/6/21
to hddm-users
Hello community,

I am using hddm in google colab which works perfectly fine. However, I encounter the following error trying to plot posterior predictive checks:

AttributeError Traceback (most recent call last) <ipython-input-32-ece9fc8693d9> in <module>() ----> 1 m_6.plot_posterior_predictive()
7 frames
/usr/local/lib/python3.7/dist-packages/matplotlib/artist.py in _update_property(self, k, v) 1000 if not callable(func): 1001 raise AttributeError('{!r} object has no property {!r}' -> 1002 .format(type(self).__name__, k)) 1003 return func(v) 1004 

AttributeError: 'Polygon' object has no property 'normed'

Anyone a quick and dirty workaround? If not I will try to use the docker image.

All the Best from Berlin,

Carina


Alexander Fengler

unread,
Apr 6, 2021, 10:59:32 AM4/6/21
to hddm-users
Hi Carina,

could you try to reinstall (the newest version of) kabuki ?

I can't tell for certain from the error message you provided but the 'normed' property in histograms is deprecated.
This is changed to the 'density = True' argument in the newest kabuki version.

Prob worth a shot.

If this doesn't work, could you post a more complete error traceback ?

Best,
Alex

dgdi...@gmail.com

unread,
Apr 13, 2021, 11:03:10 AM4/13/21
to hddm-users
Hi Carina and Alex. I ran into the same error and tried pip installing the latest version of kabuki but to no avail. But there's an easy fix--see here https://github.com/hddm-devs/kabuki/commit/5f09c6fc4bdd2f16820ae5ea93e1a9987ad58ad1 for the change that needs to be made to analyze.py in kabuki: just edit "normed=True" to "density=True". I made that change and it worked.

While I'm at it, I ran into another problem whose fix also involved a change to the same file. When I tried to run post_pred_gen on a particular model, I got a "positional indexers are out-of-bounds" error that I traced back to line 324, which is:

    iter_data = ((name, model.data.iloc[obs['node'].value.index]) for name, obs in model.iter_observeds())

I think the error emerges b/c that ".iloc" should be ".loc"; making this change caused this second error to go away and post_pred_gen ran successfully.

Hope this helps!

Dan



dgdi...@gmail.com

unread,
Apr 13, 2021, 11:09:12 AM4/13/21
to hddm-users
Obviously the fact that the link I posted comes from the kabuki GitHub page implies that I've not got the very latest version of kabuki, and (also obviously) it would be better to use that then resort to the hacks I made:) But they'll work in a pinch . . . 

dd

Reply all
Reply to author
Forward
0 new messages