BNLearner.setFCIMaxPathLength
- BNLearner.setFCIMaxPathLength(max_len)
Set the maximum conditioning set size for independence tests used by FCI.
- Parameters:
max_len (
int) – maximum path length (conditioning set size). Use -1 for unlimited.- Returns:
the BNLearner itself, to allow method chaining.
- Return type:
- Raises:
pyagrum.OperationNotAllowed – If FCI has not been selected (call
useFCI()first).
Example
import pyagrum as gum
with open("data.csv", "w") as f: # C is mostly "A or B"
f.write("A,B,C\n" + "0,0,0\n0,1,1\n1,0,1\n1,1,1\n" * 40 + "0,0,1\n0,1,0\n1,0,0\n1,1,0\n" * 5)
learner = gum.BNLearner("data.csv")
learner.useFCI().setFCIMaxPathLength(1)
pag = learner.learnPAG()
print(pag)
# {0<A>,1<B>,2<C>} , {0 o-> 2, 1 o-> 2}
Class