Learn R Programming

⚠️There's a newer version (1.0.15) of this package.Take me there.

bnstruct

R package for Bayesian Network Structure Learning from Data with Missing Values

Introduction

Bayesian Networks are a powerful tool for probabilistic inference among a set of variables, modeled using a directed acyclic graph. However, one often does not have the network, but only a set of observations, and wants to reconstruct the network that generated the data. The bnstruct package provides objects and methods for learning the structure and parameters of the network in various situations, such as in presence of missing data, for which it is possible to perform imputation (guessing the missing values, by looking at the data). The package also contains methods for learning using the Bootstrap technique. Finally, bnstruct, has a set of additional tools to use Bayesian Networks, such as methods to perform belief propagation.

In particular, the absence of some observations in the dataset is a very common situation in real-life applications such as biology or medicine, but very few software around is devoted to address these problems. bnstruct is developed mainly with the purpose of filling this void.

Installation

The latest stable version of bnstruct is available on CRAN and can be installed with

install.packages("bnstruct")

from within an R session.

The latest development version of bnstruct can be found on GitHub here.

In order to install the package, it suffices to launch R CMD INSTALL path/to/bnstruct from a terminal, or make install from within the package source folder.

Being hosted on GitHub, it is also possible to use the install_github tool from an R session:

library("devtools")
install_github("sambofra/bnstruct")

For Windows platforms, a binary executable of the latest stable version is available on CRAN.

bnstruct requires R >= 3.5, and depends on bitops, igraph, Matrix, graph and methods. Package Rgraphviz is requested in order to plot graphs, but is not mandatory.

Reference

If you bnstruct in your work, please cite it as:

Alberto Franzin, Francesco Sambo, Barbara di Camillo. "bnstruct: an R package for Bayesian Network structure learning in the presence of missing data." Bioinformatics, 2017; 33 (8): 1250-1252; Oxford University Press.

These information and a BibTeX entry can be found with

citation("bnstruct")

Copy Link

Version

Install

install.packages('bnstruct')

Monthly Downloads

740

Version

1.0.6

License

GPL (>= 2) | file LICENSE

Maintainer

Last Published

July 9th, 2019

Functions in bnstruct (1.0.6)

bn<-

set the original BN object contained in an InferenceEngine.
bn

get the BN object contained in an InferenceEngine.
BN-class

BN class definition.
BNDataset-class

BNDataset class.
asia_10000

Asia dataset.
boot

get selected element of bootstrap list.
boots<-

asia

load Asia dataset.
discreteness

get status (discrete or continuous) of the variables of an object.
edge.dir.wpdag

counts the edges in a WPDAG with their directionality
child

load Child dataset.
build.junction.tree

build a JunctionTree.
jt.cliques

child_NA_5000

Child dataset.
InferenceEngine-class

InferenceEngine class.
has.imputed.data

check if a BNDataset contains impited data.
num.boots

has.raw.data

check if a BNDataset contains raw data.
dag<-

set adjacency matrix of an object.
observations<-

dag

get adjacency matrix of a network.
num.boots<-

complete

Subset a BNDataset to get only complete cases.
add.observations<-

has.boots

check whether a BNDataset has bootstrap samples or not.
em

expectation-maximization algorithm.
belief.propagation

perform belief propagation.
cpts

data.file<-

dag.to.cpdag

convert a DAG to a CPDAG
asia_2_layers

load a two-layers dataset derived from the Asia dataset.
cpts<-

set the list of conditional probability tables of a network.
imp.boots

get.most.probable.values

compute the most probable values to be observed.
imp.boots<-

has.imputed.boots

check whether a BNDataset has bootstrap samples from imputed data or not.
boots

print

name

get name of an object.
jpts<-

num.variables

struct.algo

Read the algorithm used to learn the structure of a network.
imputed.data

get imputed data of a BNDataset.
num.variables<-

plot

plot a BN as a picture.
name<-

set name of an object.
bootstrap

Perform bootstrap.
header.file<-

num.items<-

read.dsc

Read a network from a .dsc file.
save.to.eps

save a BN picture as .eps file.
num.items

junction.tree<-

scoring.func<-

Set the scoring function used to learn the structure of a network.
read.net

Read a network from a .net file.
header.file

junction.tree

discreteness<-

set status (discrete or continuous) of the variables of an object.
data.file

impute

Impute a BNDataset raw data with missing values.
node.sizes<-

set the size of variables of an object.
layering

return the layering of the nodes.
imputed.data<-

add imputed data.
node.sizes

get size of the variables of an object.
learn.dynamic.network

knn.impute

Perform imputation of a data frame using k-NN.
observations

jpts

learn.params

learn.network

num.time.steps<-

num.time.steps

num.nodes<-

set number of nodes of an object.
read.bif

Read a network from a .bif file.
show

Show method for objects.
scoring.func

Read the scoring function used to learn the structure of a network.
write.dsc

Write a network saving it in a .dsc file.
shd

compute the Structural Hamming Distance between two adjacency matrices.
read.dataset

Read a dataset from file.
num.nodes

get number of nodes of an object.
struct.algo<-

Set the algorithm used to learn the structure of a network.
updated.bn<-

set the updated BN object contained in an InferenceEngine.
write_xgmml

Write a network saving it in an XGMML file.
variables<-

set variables of an object.
tune.knn.impute

tune the parameter k of the knn algorithm used in imputation.
quantiles<-

set the list of quantiles of an object.
updated.bn

get the updated BN object contained in an InferenceEngine.
quantiles

get the list of quantiles of an object.
test.updated.bn

wpdag

get the WPDAG of an object.
wpdag.from.dag

Initialize a WPDAG from a DAG.
learn.structure

learn the structure of a network.
jt.cliques<-

raw.data<-

add raw data.
sample.dataset

sample a BNDataset from a network of an inference engine.
sample.row

sample a row vector of values for a network.
raw.data

get raw data of a BNDataset.
marginals

compute the list of inferred marginals of a BN.
variables

get variables of an object.
wpdag<-

set WPDAG of the object.