API Reference#

Public API reference for pgmpy.

Browse by workflow or object family to find the public classes and helper functions for that part of the library.

Deprecated compatibility aliases are intentionally omitted from the main API listings in favor of the current class names.

Graph Classes

DAG, PDAG, MAG, PAG, and other base graph structures.

Graph Classes
Models

Bayesian networks, SEMs, Markov models, and derived graph structures.

Models
Factors And CPDs

Discrete factors, CPDs, Gaussian CPDs, hybrid CPDs, and factor utilities.

Factors and CPDs
Inference And Sampling

Exact inference, approximate inference, sampling, and elimination-order helpers.

Inference and Sampling
Causal Inference

Identification, interventional inference, and regression-based causal estimators.

Causal Inference
Parameter Estimation

Estimator base classes, MLE, Bayesian estimation, EM, SEM fitting, and mirror descent.

Parameter Estimation
Causal Discovery

Constraint-based, score-based, tree-based, and expert-guided discovery algorithms.

Causal Discovery and Structure Learning
Conditional Independence (CI) Tests

Built-in CI test selectors and test implementations.

Conditional Independence (CI) Tests
Structure Scores

Discrete, Gaussian, and conditional-Gaussian structure scoring classes.

Structure Scoring
Metrics

Supervised and unsupervised metrics for evaluating learned graphs and fitted models.

Metrics
Reading/Writing

Reader and writer classes for BIF, XMLBIF, XDSL, UAI, PomdpX, and related formats.

Reading/Writing
Datasets And Examples

Built-in dataset loaders and example-model discovery helpers.

Datasets and Example Models
Independencies

Independence assertions and collections used across discovery and testing workflows.

Independencies