Learn R Programming

bnlearn (version 5.2.1)

Bayesian Network Structure Learning, Parameter Learning and Inference

Description

Bayesian network structure learning, parameter learning and inference. This package implements constraint-based (PC, GS, IAMB, Inter-IAMB, MMPC, Hiton-PC, HPC), pairwise (ARACNE and Chow-Liu), score-based (Hill-Climbing, Tabu Search, DirectLiNGAM) and hybrid (MMHC, RSMAX2, H2PC) structure learning algorithms for discrete, Gaussian, conditional Gaussian and zero-inflated networks, along with many score functions and conditional independence tests. The Naive Bayes and the Tree-Augmented Naive Bayes (TAN) classifiers are also implemented. Some utility functions (model comparison and manipulation, random data generation, arc orientation testing, simple and advanced plots) are included, as well as support for parameter estimation (maximum likelihood and Bayesian) and inference, conditional probability queries, interventions, counterfactuals, cross-validation, bootstrap and model averaging. Development snapshots with the latest bugfixes are available from .

Copy Link

Version

Install

install.packages('bnlearn')

Monthly Downloads

39,518

Version

5.2.1

License

GPL (>= 2)

Maintainer

Marco Scutari

Last Published

July 17th, 2026

Functions in bnlearn (5.2.1)

bn.fit class

The bn.fit class structure
bn.strength class

The bn.strength class structure
bn.boot

Nonparametric bootstrap of Bayesian networks
bnlearn-package

Bayesian network structure learning, parameter learning and inference
bn.fit plots

Plot fitted Bayesian networks
causal inference

Perform causal inference
bn.fit utilities

Utilities to manipulate fitted Bayesian networks
bn.kcv class

The bn.kcv class structure
bn.fit

Fit the parameters of a Bayesian network
causal discovery algorithms

Causal discovery algorithms
coronary

Coronary heart disease data set
constraint-based algorithms

Constraint-based structure learning algorithms
clgaussian.test

Synthetic (mixed) data set to test learning algorithms
graph enumeration

Count graphs with specific characteristics
independence-tests

Conditional independence tests
configs

Construct configurations of discrete variables
cpquery

Perform conditional probability queries
compare

Compare two or more different Bayesian networks
ci.test

Independence and conditional independence tests
cpdag

Equivalence classes, moral graphs and consistent extensions
graphviz.chart

Plotting networks with parameter summaries
graph utilities

Utilities to manipulate graphs
foreign files utilities

Read and write BIF, NET, DSC and DOT files
gaussian.test

Synthetic (continuous) data set to test learning algorithms
graph generation utilities

Generate empty, complete or random graphs
graphviz.plot

Advanced Bayesian network plots
graph integration

Import and export networks from the graph package
gRain integration

Import and export networks from the gRain package
hailfinder

The HailFinder weather forecast system (synthetic) data set
dsep

Test d-separation
hybrid algorithms

Hybrid structure learning algorithms
score-based algorithms

Score-based structure learning algorithms
information theoretic quantities

Compute the distance between two fitted Bayesian networks
igraph integration

Import and export networks from the igraph package
learning.test

Synthetic (discrete) data set to test learning algorithms
single-node local discovery

Discover the structure around a single node
marks

Examination marks data set
insurance

Insurance evaluation network (synthetic) data set
lizards

Lizards' perching behaviour data set
misc utilities

Miscellaneous utilities
multivariate normal distribution

Gaussian Bayesian networks and multivariate normals
node ordering utilities

Partial node orderings
plot.bn.strength

Plot arc strengths derived from bootstrap
model string utilities

Build a model string from a Bayesian network and vice versa
local discovery algorithms

Local discovery structure learning algorithms
node operations

Manipulate nodes in a graph
plot.bn

Plot a Bayesian network
pcalg integration

Import and export networks from the pcalg package
network-scores

Network scores
naive.bayes

Naive Bayes classifiers
strength.plot

Arc strength plot
score

Score of the Bayesian network
data preprocessing

Pre-process data to better learn Bayesian networks
lm integration

Produce lm objects from Bayesian networks
rbn

Simulate random samples from a given Bayesian network
whitelists-blacklists

Whitelists and blacklists in structure learning
structural.em

Structure learning from missing data
predict and impute

Predict or impute missing data from a Bayesian network
test counter

Manipulating the test counter
scm class

The scm class structure
structure-learning

Structure learning algorithms
BF

Bayes factor between two network structures
alarm

ALARM monitoring system (synthetic) data set
network-classifiers

Bayesian network Classifiers
bn.cv

Cross-validation for Bayesian networks
asia

Asia (synthetic) data set by Lauritzen and Spiegelhalter
utilities for whitelists and blacklists

Get or create whitelists and blacklists
arc.strength

Measure arc strength
arc operations

Drop, add or set the direction of an arc or an edge
bn class

The bn class structure
alpha.star

Estimate the optimal imaginary sample size for BDe(u)