BNMixture.existsArc

BNMixture.existsArc(a, b)

Counts the BNs of the model that contain the arc a -> b, whatever their weights (a BN added several times is stored once, with a larger weight, and counts once). See pyagrum.bnmixture.BNMixture.arcConfidence for the weighted frequency of the arc.

Parameters:
  • a (int | str) – Tail of the arc.

  • b (int | str) – Head of the arc.

Returns:

The number of BNs containing the arc a -> b.

Return type:

int

Example

import pyagrum as gum
import pyagrum.bnmixture as bnm

mix = bnm.BNMixture()
mix.add("bn1", gum.fastBN("A->B->C"), w=0.6)
mix.add("bn2", gum.fastBN("A->B;A->C"), w=0.4)
mix.existsArc("A", "B")  # number of BNs with the arc A->B
# 2
mix.existsArc("B", "C")
# 1

Class

BNMixture