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 >= 2.10, and depends on bitops, igraph, Matrix, graph and methods. Package Rgraphviz is requested in order to plot graphs, but is not mandatory.

Copy Link

Version

Install

install.packages('bnstruct')

Monthly Downloads

428

Version

1.0.2

License

GPL (>= 2) | file LICENSE

Maintainer

Francesco Sambo

Last Published

December 13th, 2016

Functions in bnstruct (1.0.2)

add.observations<-

boot

get selected element of bootstrap list.
asia

load Asia dataset.
belief.propagation

perform belief propagation.
boots<-

BNDataset-class

BNDataset class.
bn

get the BN object contained in an InferenceEngine.
asia_10000

Asia dataset.
BN-class

BN class definition.
bn<-

set the original BN object contained in an InferenceEngine.
child_NA_5000

Child dataset.
dag

get adjacency matrix of a network.
dag<-

set adjacency matrix of an object.
bootstrap

Perform bootstrap.
child

load Child dataset.
complete

Subset a BNDataset to get only complete cases.
cpts

boots

build.junction.tree

build a JunctionTree.
cpts<-

set the list of conditional probability tables of a network.
dag.to.cpdag

convert a DAG to a CPDAG
data.file<-

data.file

jpts<-

InferenceEngine-class

InferenceEngine class.
discreteness<-

set status (discrete or continuous) of the variables of an object.
get.most.probable.values

compute the most probable values to be observed.
imputed.data<-

add imputed data.
has.boots

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

get imputed data of a BNDataset.
discreteness

get status (discrete or continuous) of the variables of an object.
impute

Impute a BNDataset raw data with missing values.
imp.boots

em

expectation-maximization algorithm.
learn.params

learn.network

knn.impute

Perform imputation of a data frame using k-NN.
junction.tree

layering

return the layering of the nodes.
learn.dynamic.network

header.file

imp.boots<-

has.imputed.data

check if a BNDataset contains impited data.
has.raw.data

check if a BNDataset contains raw data.
jt.cliques<-

has.imputed.boots

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

header.file<-

jt.cliques

junction.tree<-

name

get name of an object.
name<-

set name of an object.
read.net

Read a network from a .net file.
read.dsc

Read a network from a .dsc file.
num.items

num.items<-

struct.algo<-

Set the algorithm used to learn the structure of a network.
show

Show method for objects.
node.sizes<-

set the size of variables of an object.
node.sizes

get size of the variables of an object.
num.variables

num.variables<-

save.to.eps

save a BN picture as .eps file.
variables<-

set variables of an object.
updated.bn<-

set the updated BN object contained in an InferenceEngine.
scoring.func<-

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

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

Initialize a WPDAG from a DAG.
marginals

compute the list of inferred marginals of a BN.
learn.structure

learn the structure of a network.
plot

plot a BN as a picture.
print

print an object to stdout.
read.dataset

Read a dataset from file.
read.bif

Read a network from a .bif file.
test.updated.bn

struct.algo

Read the algorithm used to learn the structure of a network.
num.time.steps<-

tune.knn.impute

tune the parameter k of the knn algorithm used in imputation.
num.time.steps

updated.bn

get the updated BN object contained in an InferenceEngine.
num.boots<-

num.boots

num.nodes

get number of nodes of an object.
num.nodes<-

set number of nodes of an object.
raw.data<-

add raw data.
raw.data

get raw data of a BNDataset.
variables

get variables of an object.
wpdag<-

set WPDAG of the object.
observations<-

observations

sample.dataset

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

sample a row vector of values for a network.
shd

compute the Structural Hamming Distance between two adjacency matrices.
scoring.func

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

Write a network saving it in an XGMML file.
write.dsc

Write a network saving it in a .dsc file.
add.observations<-

boots<-

name<-

set name of an object.
jt.cliques<-

discreteness<-

set status (discrete or continuous) of the variables of an object.
dag<-

set adjacency matrix of an object.
junction.tree<-

data.file<-

num.time.steps<-

scoring.func<-

Set the scoring function used to learn the structure of a network.
jpts<-

bn<-

set the original BN object contained in an InferenceEngine.
cpts<-

set the list of conditional probability tables of a network.
header.file<-

struct.algo<-

Set the algorithm used to learn the structure of a network.
imp.boots<-

imputed.data<-

add imputed data.
num.items<-

observations<-

raw.data<-

add raw data.
num.boots<-

node.sizes<-

set the size of variables of an object.
num.variables<-

num.nodes<-

set number of nodes of an object.
variables<-

set variables of an object.
updated.bn<-

set the updated BN object contained in an InferenceEngine.
wpdag<-

set WPDAG of the object.