BayesianModelInference#
- class pgmpy.sampling.BayesianModelInference(model)[source]#
Bases:
InferenceClass to calculate probability (pmf) values specific to Bayesian Models
- Parameters:
- model: Bayesian Model
model on which inference queries will be computed
- pre_compute_reduce(variable)[source]#
Get probability arrays for a node as function of conditional dependencies
Internal function used for Bayesian networks, eg. in BayesianModelSampling and BayesianModelProbability.
- Parameters:
- variable: Bayesian Model Node
node of the Bayesian network
- Returns:
- dict: dictionary with probability array for node
as function of conditional dependency values
- pre_compute_reduce_maps(variable, evidence=None, state_combinations=None)[source]#
Get probability array-maps for a node as function of conditional dependencies
Internal function used for Bayesian networks, eg. in BayesianModelSampling and BayesianModelProbability.
- Parameters:
- variable: Bayesian Model Node
node of the Bayesian network
- evidence: list
List of evidence variables to compute the reduced values for. Rest of the parent varaibles of the node are marginalized.
- state_combinations: list (default=None)
List of tuple of state combinations for which to compute the reductions maps.
- Returns:
- dict: dictionary with probability array-index for node as function of conditional dependency values,
dictionary with mapping of probability array-index to probability array.