MonteCarloSampling.evidenceImpact

MonteCarloSampling.evidenceImpact(target, evs)

Create a pyagrum.Tensor for P(target|evs) (for all instanciation of target and evs)

Parameters:
  • target (int | str) – the id or the name of the target

  • evs (set[int | str] | list[int | str]) – the ids or names of the nodes of evidence

Warning

if some evs are d-separated, they are not included in the Tensor.

Returns:

a Tensor for P(targets|evs)

Return type:

pyagrum.Tensor

Example

import pyagrum as gum

bn = gum.fastBN("A->B<-C", uniform=True)
ie = gum.MonteCarloSampling(bn)
p = ie.evidenceImpact("B", ["A", "C"])  # P(B|A,C)
p.names, p.shape
# (('B', 'A', 'C'), (2, 2, 2))

Class

MonteCarloSampling

Overridden in

LoopyMonteCarloSampling.evidenceImpact