All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Uniform warning behavior for commas in state names across file writers (BIF, XMLBIF, NET, XDSL).
- Writers now issue a warning when state names contain commas, which can cause issues when loading the file.
- The warning helps users identify potentially problematic state names.
- This affects
BIFWriter,XMLBIFWriter,NETWriter, andXDSLWriterclasses. - Note: While XDSL format can handle commas in state names, a warning is still issued for consistency.
BIFWriter.get_statesno longer silently replaces commas with underscores in state names.XMLBIFWriter._make_valid_state_namenow issues a warning when it encounters commas in state names.NETWriter.get_statesnow issues a warning when it encounters commas in state names.XDSLWriter.get_cpdsnow issues a warning when it encounters commas in state names.
- Improved consistency in how different file writers handle state names with special characters.
- Option to specify the node names in random model generation methods.
- ExpertInLoop.estimate method now accepts any LLM model supported by litellm.
- AIC and BIC structure scoring methods for Gaussian variables and Conditional Gaussian variables.
- Greedy Equivalence Search algorithm for causal discovery.
- Causal Discovery algorithms can automatically figure out the data types of the variables.
- Support for continuous and mixed data types for all causal discovery / structure learning algorithms.
- Adds LinearGaussianBayesianNetwork and FunctionalBayesianNetwork classes to represent Gaussian and hybrid Bayesian Networks.
- Add
pgmpy.metrics.SHDto compute the Structural Hamming Distance between two DAGs. - Adds
NoisyORCPDclass to represent NoisyOr models. - BayesianNetwork.simulate method can not simulate different types of missing data.
- BayesianNetwork.predict now predicts any missing value in the dataframe instead of missing columns.
- Adds continuous example models from bnlearn repository.
- Adds
ExpertKnowledgeclass to specify expert knowledge for structure learning algorithms. - Option to initialize DAG and DiscreteBayesianNetwork with adjacency matrix, a dagitty model, or a lavaan model string.
- Adds method for reading and writing XDSL file format (used by GeNIe).
- Adds Generalized Covariance Measure (GCM) conditional independence test.
- Fixes bug in
pgmpy.estimators.SEMEstimator.
- Renames
pgmpy.estimators.CITests.ci_pillaitopgmpy.estimators.CITests.pillai_trace. BayesianNetwork.fitmethod moved toDAG.fitso that fitting can be done on either model types.- All structure scoring methods have been renamed to simplify.
- Removes some of the CI test variants of chi-squared test.
- Removes
pgmpy.factors.continuous.ContinuousFactorclass. - Removes discretization methods for ContinuousFactor.
BayesianModelandMarkovModelclasses have been removed.BayesianNetworkclass have been removed. UseDiscreteBayesianNetworkinstead.
- Support for returning Belief Propagation messages in Factor Graph BP.
- Maximum Likelihood Estimator for Junction Tree.
- Adds a simple discretization method:
pgmpy.utils.discretize. - Two new metrics for model testing:
pgmpy.metrics.implied_cisandpgmpy.metrics.fisher_c. - Support for Linear Gaussian Bayesian Networks: estimation, prediction, simulation and random model generation.
- New mixed data Conditional Independence test based on canonical correlations.
- New LLM based structure learning / causal discovery algorithm. Also LLM based pairwise variable orientation method.
- Reading and Writing from XBN file format.
- Documentation for plotting models.
- Fixes PC algorithm to add disconnected nodes in the final model.
- Allows
.in variables names in BIF file format.
- Allows
virtual_evidenceparameter in inference methods to accept DiscreteFactor objects.
init_cpdsargument toExpecattionMaximiation.get_parametersto specify initialization values.- BeliefPropagation with message passing for Factor Graphs.
- Marginal Inference for undirected graphs.
- Incompatibality with networkx==3.2.
CausalInference.get_minimal_adjustment_setto accept string variable names.- Bug in EM when latent variables are present.
compat_fns.copyto consider the case when int or float is passed.- Fixes issue with
BayesianNetwork.fit_updatewhen running with CUDA backend.
- Documentation Updates
- Optimizations for Hill Climb Search algorithm.
- Tests shutdown parallel workers in teardown.
- Removes the
complete_samples_onlyargument fromBaseEstimator.state_counts. - Default number of cores to use changed to 1 for parameter estimation methods.
- Added support for python 3.11.
- Adds
DAG.to_graphvizandPDAG.to_graphvizmethods to convert model to graphviz objects. - Adds pytorch as an alternative backend.
- Adds unicode support for BIFReader.
- Warnings use a logger instance.
- Fixes documentation.
- Fixes variables name arguments for
CausalInference.get_minimal_adjustment_set
- Adds argument to specify samples for ApproxInference.
- Memory optimizations for computing structure scores.
- Switches joblib backed to loky.
- Runtime optimizations for sampling.
- Runtime optimizations for Variable Elimination.
- All config variables moved to
pgmpy.global_vars.
- BIFReader made compatible with the output of PyAgrum
- Support for all available CI tests in PC algorithm.
- References for read/write file formats.
- Removes
DAG.to_pdagmethod.
- Fixes for ApproxInference for DBNs.
- Make
xml.etreethe default parser instead of using lxml.
- AIC score metric from score based structure learning.
- Adds support for NET (HUGIN) file format.
- Adds argument reindex to
state_countsmethod.
- Bug in GibbsSampling when sampling from Bayesian Networks.
- Fix seed for all simulation methods.
- Memory leaks when using
lru_cache.
- Caching disabled for computing state name counts during structure learning.
- Pre-computation for sampling methods are optimized.
BayesianNetwork.get_state_probabilitymethod to compute the probability of a given evidence.BayesianEstimator.estimate_cpdaccepts weighted datasets.
- Fixes bug in
CausalInference.estimate_atewith front-door criterion. - Fixes inference bugs when variable has a single state.
BayesianNetwork.get_random_cpdsmethod to randomly parameterize a network structure.- Faster Variable Elimination using tensor contraction.
factors.factor_sum_productmethod for faster sum-product operations using tensor contraction.
- Bug in
DynamicBayesianNetwork.initialize_initial_state. #1564 - Bug in
factors.factor_product. #1565
- Runtime improvements in
DiscreteFactor.marginalizeandDiscreteFactor.copymethods.
- Adds checks for arguments to
BayesianNetwork.simulatemethod.
- Fixes TAN algorithm to use conditional information metric.
- Speed ups for all estimation and inference methods.
- Fix in stable variant of PC algorithm to give reproducible results.
- Fix in
GibbsSamplingfor it to work with variables with integral names. DAG.active_trail_nodesallows tuples as variable names.- Fixes CPD and edge creation in
UAIReader.
- Fixes
CausalInference.is_valid_backdoor_adjustment_setto accept str arguments forZ. - Fixes
BayesianNetwork.remove_cpdto work with integral node names. - Fixes
MPLP.map_queryto return the variable states instead of probability values. - Fixes BIFWriter to generate output in standard BIF format.
- Adds BayesianNetwork.states property to store states of all the variables.
- Adds extra checks in check model for state names
- Fixes typos in BayesianModel deprecation warning
- Bug fix in printing Linear Gaussian CPD
- Update example notebooks to work on latest dev.
- Adds a
fit_updatemethod toBayesianNetworkfor updating model using new data. - Adds
simulatemethod toBayesianNetworkandDynamicBayesianNetworkto simulated data under different conditions. - Adds
DynamicBayesianNetwork.fitmethod to learn model parameters from data. ApproxInferenceclass to do approximate inference on models using sampling.- Robust tests for all sampling methods.
- Adds
BayesianNetwork.loadandBayesianNetwork.saveto quickly read and write files.
BayesianModelandMarkovModelrenamed toBayesianNetworkandMarkovNetworkrespectively.- The default value of node position in
DAG.to_daftmethod. - Documentation updated on the website.
- Fixes bug in
DAG.is_iequivalentmethod. - Automatically truncate table when CPD is too large.
- Auto-adjustment of probability values when they don't exactly sum to 1.
- tqdm works both in notebooks and terminal.
- Fixes bug in
CausalInference.querymethod.
- Adds network pruning for inference algorithms to reduce the size of network before running inference.
- Adds support for latent variables in DAG and BayesianModel.
- Parallel implementation for parameter estimation algorithms.
- Adds
DAG.get_randomandBayesianModel.get_randommethods to be able to generate random models. - Adds
CausalInference.querymethod for doing do operation inference with or without adjustment sets. - Adds functionality to treesearch to do auto root and class node selection (#1418)
- Adds option to specify virtual evidence in bayesian network inference.
- Adds Expectation-Maximization (EM) algorithm for parameter estimation in latent variable models.
- Add
BDeuScoreas another option for structure score when using HillClimbSearch. - Adds CausalInference.get_minimal_adjustment_set` for finding adjustment sets.
- Renames
DAG.is_active_trailtois_dconnected. DAG.docan accept multiple variables in the argument.- Optimizes sampling methods.
- CI moved from travis and appveyor to github actions.
- Drops support for python 3.6. Requires 3.7+.
- Example model files were not getting included in the pypi and conda packages.
- The order of values returned by CI tests was wrong. #1403
- Adjusted and normalized MI wasn't working properly in TreeSearch.
- #1423: Value error in bayesian estimation.
- Fixes bug in
DiscreteFactor.__eq__to also consider the state names order.
- Adds support for python 3.9.
BayesianModelProbabilityclass for calculating pmf for BNs.- BayesianModel.predict has a new argument
stochasticwhich returns stochastic results instead of MAP. - Adds new method pgmpy.base.DAG.to_daft to easily convert models into publishable plots.
pgmpy.utils.get_example_modelnow doesn't need internet connection to work. Files moved locally.
- Latex output of
pgmpy.DAG.get_independencies. - Bug fix in PC algorithm as it was skipping some combinations.
- Error in sampling because of seed not correctly set.
- New conditional independence tests for discrete variables
- Adds warning in BayesianEstimator when using dirichlet prior.
- Bug in
PC.skeleton_to_pdag. - Bug in
HillClimbSearchwhen no legal operations.
- PC estimator with original, stable, and parallel variants.
- PDAG class to represent partially directed DAGs.
pgmpy.utils.get_example_modelfunction to fetch models from bnlearn repository.- Refactor HillClimbSearch with a new feature to specify fixed edges in the model.
- Adds a global
SHOW_PROGRESSvariable. - Adds Chow-Liu structure learning algorithm.
- Add
pgmpy.utils.get_example_modelto fetch models from bnlearn's repository. - Adds
get_valueandset_valuemethod toDiscreteFactorto get/set a single value. - Adds
get_acestral_graphtoDAG.
- Refactors ConstraintBasedEstimators into PC with a lot of general improvements.
- Improved (faster, new arguments) independence tests with changes in argument.
- Refactors
sample_discretemethod. Sampling algorithms much faster. - Refactors
HillClimbSearchto be faster. - Sampling methods now return dataframe of type categorical.
Dataclass.
- New example notebook: Alarm.ipynb
- Support for python 3.8
- Score Caching support for scoring methods.
- Code quality check moved to codacy from landscape
- Additional parameter
max_ci_varsforConstraintBasedEstimator. - Additional parameter
pseudo_countfor K2 score. - Sampling methods return state names instead of number when available.
- XMLBIFReader and BIFReader not accepts argument for specifying state name type.
- Additional checks for TabularCPD values shape.
DiscreteFactor.reduceaccepts both state names and state numbers for variables.BeliefPropagation.queryfixed to return normalized CPDs.- Bug in flip operation in
HillClimbSearch. - BIFWriter to write the state names to file if available.
BayesianModel.to_markov_modelfixed to work with disconnected graphs.- VariableElimination fixed to not ignore identifical factors.
- Fixes automatic sorting of state names in estimators.
- No support for ProbModelXML file format.
- Documentation updated to include Structural Equation Models(SEM) and Causal Inference.
- Adds Mmhc estimator.
- BdeuScore is renamed to BDeuScore.
- Refactoring of NaiveBayes
- Overhaul of CI and setup infrastructure.
- query methods check for common variables in variable and evidence argument.
- Example notebooks for Inference.
- DAG.moralize gives consistent results for disconnected graphs.
- Fixes problems with XMLBIF and BIF reader and writer classes to be consistent.
- Better integration of state names throughout the package.
- Improves remove_factors and add_factors methods of FactorGraph
- copy method of TabularCPD and DiscreteFactor now makes a copy of state names.
- six not a dependency anymore.