causalincentives / pycid

Library for graphical models of decision making, based on pgmpy and networkx
Apache License 2.0
96 stars 13 forks source link

AttributeError: 'CID' object has no attribute 'is_dconnected' in Why_fairness_labels notebook #58

Closed sbenthall closed 2 years ago

sbenthall commented 2 years ago

Describe the Issue A clear and concise description of what the Issue is.

Your environment

Steps to reproduce In the Why_fair_labels_may_yield_unfair_models_AAAI_22 notebook, in cell [4], I get the error:

AttributeError: 'CID' object has no attribute 'is_dconnected'
RyanCarey commented 2 years ago

Pgmpy renamed a method name (that we inherit) from "is_active_trail" to "is_dconnected", and we've updated accordingly. Try upgrading your pgmpy to 0.1.17 to fix the problem.

sbenthall commented 2 years ago

Thank you. This was indeed an environment issue. It's fixed on my end.

For what it's worth, I'm getting different results in two different environments still:

#importing necessary libraries
try:
    import pycid
except ModuleNotFoundError:
    import sys
    !{sys.executable} -m pip install git+https://github.com/causalincentives/pycid
    import pycid

For some reason, in this environment pgmpy is installed as version 0.1.13.

RyanCarey commented 2 years ago

Good! Re the general Python3 environment, I think git calls setup.py, which calls setup.cfg, which does currently include the code install_requires=pgmpy==0.1.17. Not sure why it's not working. @Jamesfox1 , any ideas?

Jamesfox1 commented 2 years ago

Thanks for identifying this @sbenthall ! I think I've now fixed this problem with the latest PyCID release.

Namely, running the following does now install pgmpy as version 0.1.17:

try:
    import pycid
except ModuleNotFoundError:
    import sys
    !{sys.executable} -m pip install git+https://github.com/causalincentives/pycid
    import pycid