KTBNAdaptiveLearner.checkScorePriorCompatibility
- KTBNAdaptiveLearner.checkScorePriorCompatibility()
Data-free check: evaluates the recorded (score, prior) pair as
pyagrum.ktbn.KTBNLearnerwould, so an incompatible combination can be caught before learnKTBN reads any trajectory.- Returns:
a warning message if the current score and prior are incompatible, an empty string otherwise
- Return type:
str
Example
import pyagrum as gum
import pyagrum.ktbn as ktbn
gum.initRandom(42)
model = ktbn.KTBN.fromBN(gum.fastBN("X0->X1->Y1;Y0"))
ktbn.KTBNDatabaseGenerator(model).drawSamples(50, 10, ".", "traj") # traj1.csv ... traj50.csv
learner = ktbn.KTBNAdaptiveLearner(".", "traj", 50, 3, gum.fastBN("X;Y")) # k in [2, 3]
learner.useGreedyHillClimbing()
learner.useScoreBD()
learner.checkScorePriorCompatibility()
# 'The BD score requires a prior'
learner.useSmoothingPrior()
learner.checkScorePriorCompatibility()
# 'The prior is currently compatible with the BD score but if you change the weight, it may become biased'
Class