Operation not allowed (MuiltiDimCombineAndProject) when running inference with multiple joint targets
I am running into an issue when randomly drawing sets of nodes from a BN and running inference on them.
Consider this code using pyagrum (latest version 1.11.0 installed):
bn = grum.randomBN(n = 100)
sample_ids = random.sample(sorted(bn.nodes()), k = 15)
chunk_size = 5
chunks = [sample_ids[x:x+chunk_size] for x in range(0, len(sample_ids),chunk_size)]
ie = grum.LazyPropagation(bn)
for chunk in chunks:
ie.addJointTarget(set(chunk))
ie.makeInference()
This code works sometimes, but most of the times it generates the following error:
OperationNotAllowed: [pyAgrum] Operation not allowed: MultiDimCombineAndProject need at least one table to have some work to do.
Interestingly, if I run the following modification, I never get an error:
bn = grum.randomBN(n = 100)
sample_ids = random.sample(sorted(bn.nodes()), k = 15)
chunk_size = 5
chunks = [sample_ids[x:x+chunk_size] for x in range(0, len(sample_ids),chunk_size)]
for chunk in chunks:
ie = grum.LazyPropagation(bn)
ie.addJointTarget(set(chunk))
ie.makeInference()
While this allows me to compute the required posteriors, I would assume it's more efficient to do only one inference.
My suspicion is that the errors thrown from the first sample have something to do with the combination of certain joint targets causing problems but I do not understand the inference well enough to know what I have to check for.
Thank you very much in advance for you help.