daft-dev / daft

Render probabilistic graphical models using matplotlib
https://docs.daft-pgm.org
MIT License
675 stars 118 forks source link

daft.PGM() TypeError: __init__() missing 1 required positional argument: 'shape' #135

Closed arjan-hada closed 2 years ago

arjan-hada commented 3 years ago

The docs say the shape is an optional parameter for daft.PGM(). however, when executing "daft.PGM()" I get the following error: TypeError: init() missing 1 required positional argument: 'shape'

dfm commented 3 years ago

Please list the specific version of daft, Python, and matplotlib. Then give an executable example with the full error traceback.

jdmoore7 commented 2 years ago

Same problem today, it seems that daft.pgm expects a shape parameter but isn't offered one in a tutorial linked below Python 3.7.12 Matplotlib 3.2.2 Daft 0.0.4

Used script from this tutorial and the following error was returned, from the first line.

pgm = daft.PGM()
>>>
TypeError                                 Traceback (most recent call last)
<ipython-input-13-06303411a32e> in <module>()
      2 
      3 # Instantiate the PGM.
----> 4 pgm = daft.PGM()
      5 
      6 # # Hierarchical parameters.

TypeError: __init__() missing 1 required positional argument: 'shape'

Thanks for looking into this!

jdmoore7 commented 2 years ago

Actually, error resolves itself with Daft 0.1.2

aysuyaman commented 2 years ago

I am working on google colab as PyMC3 is not supported on my Mac. I downloaded the latest daft version with the command "!pip install daft==0.1.2" but I still get the same error. Do you have any suggestions?

dfm commented 2 years ago

What do you get when you run

import daft
print(daft.__version__)

in your Colab notebook? The Colab environment includes v0.0.4 :/ by default, so you may need to install (I use %pip install -U daft) and then restart your kernel. I find that if I do that everything works.

aysuyaman commented 2 years ago

Thank you, but it didn't help :(

Screen Shot 2022-05-03 at 19 44 55
dfm commented 2 years ago

That's cause you didn't restart your kernel!

aysuyaman commented 2 years ago

Touché! I'm a newbie. Thanks a lot 👍

dfm commented 2 years ago

Excellent - glad you got it working!!