PC build_skeleton documentation is outdated
Matyasch opened this issue · comments
Subject of the issue
The documentation of pgmpy.estimators.PC.build_skeleton
seems to be outdated, as it still describes learning "from a set of independencies" instead of the data-driven approach.
Your environment
- pgmpy version: 0.1.22
- Python version: 3.10.6
- Operating System: Ubuntu 22.04.2 LTS
Steps to reproduce
Copy pasted the official example:
from pgmpy.estimators import PC
from pgmpy.base import DAG
from pgmpy.independencies import Independencies
# build skeleton from list of independencies:
ind = Independencies(['B', 'C'], ['A', ['B', 'C'], 'D'])
# we need to compute closure, otherwise this set of independencies doesn't
# admit a faithful representation:
ind = ind.closure()
skel, sep_sets = PC(independencies=ind).build_skeleton("ABCD", ind)
print(skel.edges())
# build skeleton from d-separations of DAG:
model = DAG([('A', 'C'), ('B', 'C'), ('B', 'D'), ('C', 'E')])
skel, sep_sets = PC.build_skeleton(model.nodes(), model.get_independencies())
print(skel.edges())
Expected behaviour
Prints:
[('A', 'D'), ('B', 'D'), ('C', 'D')]
[('A', 'C'), ('B', 'C'), ('B', 'D'), ('C', 'E')]
Actual behaviour
ValueError: ci_test must either be chi_square, pearsonr, independence_match, or a function. Got: ABCD
@Matyasch Thanks for pointing this out. I have updated the docs.