NoisyOr Model

class pgmpy.models.NoisyOrModel.NoisyOrModel(variables, cardinality, inhibitor_probability)[source]

Base class for Noisy-Or models.

This is an implementation of generalized Noisy-Or models and is not limited to Boolean variables and also any arbitrary function can be used instead of the boolean OR function.

Reference: http://xenon.stanford.edu/~srinivas/research/6-UAI93-Srinivas-Generalization-of-Noisy-Or.pdf

add_variables(variables, cardinality, inhibitor_probability)[source]

Adds variables to the NoisyOrModel.

Parameters:
  • variables (list, tuple, dict (array like)) – array containing names of the variables that are to be added.

  • cardinality (list, tuple, dict (array like)) – array containing integers representing the cardinality of the variables.

  • inhibitor_probability (list, tuple, dict (array_like)) – array containing the inhibitor probabilities corresponding to each variable.

Examples

>>> from pgmpy.models import NoisyOrModel
>>> model = NoisyOrModel(['x1', 'x2', 'x3'], [2, 3, 2], [[0.6, 0.4],
...                                                      [0.2, 0.4, 0.7],
...                                                      [0.1, 0., 4]])
>>> model.add_variables(['x4'], [3], [0.1, 0.4, 0.2])
del_variables(variables)[source]

Deletes variables from the NoisyOrModel.

Parameters:

variables (list, tuple, dict (array like)) – list of variables to be deleted.

Examples

>>> from pgmpy.models import NoisyOrModel
>>> model = NoisyOrModel(['x1', 'x2', 'x3'], [2, 3, 2], [[0.6, 0.4],
...                                                      [0.2, 0.4, 0.7],
...                                                      [0.1, 0., 4]])
>>> model.del_variables(['x1'])