BNLearner.useFCI
- BNLearner.useFCI()
Indicate that we wish to use the FCI (Fast Causal Inference) algorithm.
FCI is a constraint-based structure learning algorithm that, unlike PC, handles latent confounders and selection bias. It learns a PAG (Partial Ancestral Graph) from data via conditional independence tests. Use
learnPAG()to retrieve the result.After calling
useFCI(), configure the independence test withuseFCIChi2Test()(default) oruseFCIG2Test(), and tune the significance threshold withsetFCIAlpha().- Returns:
the BNLearner itself, to allow method chaining.
- Return type:
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()
pag = learner.learnPAG()
print(pag)
# {0<A>,1<B>,2<C>} , {0 o-> 2, 1 o-> 2}
Class