Noisy OR CPDΒΆ

Initializes the NoisyORCPD class.

The NoisyOR CPD is a special case of TabularCPD for binary variables where a given variable can be activated by each of the parent variables with a specified probability. This activation probability is defined in the prob_values argument.

param variable:

The variable for which the CPD is to be defined.

type variable:

str

param prob_values:

A list of probabilities values for each evidence variable to activate variable.

type prob_values:

iterable

param evidence:

List of evidence variables, i.e., conditional variables.

type evidence:

list

Examples

>>> from pgmpy.factors.discrete import NoisyORCPD
>>> cpd = NoisyORCPD(variable="Y", prob_values=[0.3, 0.5], evidence=["X1", "X2"])
>>> from pgmpy.models import DiscreteBayesianNetwork
>>> model = DiscreteBayesianNetwork(
...     [("A", "B")]
... )  # With nodes with no parents, we can not define a NoisyORCPD.
>>> cpd_a = TabularCPD(
...     variable="A",
...     variable_card=2,
...     values=[[0.2], [0.8]],
...     state_names={"A": ["True", "False"]},
... )
>>> cpd_b = NoisyORCPD(variable="B", prob_values=[0.8], evidence=["A"])
>>> model.add_cpds(cpd_a, cpd_b)