Questions tagged [bnlearn]

bnlearn is an R package for learning the graphical structure of Bayesian networks, estimate their parameters and perform some useful inference.

bnlearn is an R package for learning the graphical structure of Bayesian networks, estimate their parameters and perform some useful inference. To get started and install the latest development snapshot type

install.packages(​"http://www.bnlearn.com/releases/​bnlearn_latest.tar.gz") in your R console.

Package webpage: http://www.bnlearn.com/

89 questions
1
vote
0 answers

using BNLearn from R in Python

I am trying to pull R libraries into python so I can use them for data processing. The library in question is BNLearn. Using rpy2, I am able to pull BNLearn into python. However whenever I try to input a list into BNlearn, I receive the following…
Hojo.Timberwolf
  • 985
  • 1
  • 11
  • 32
1
vote
0 answers

How to fix: Error in check.dnode.vs.parents(node, new = dist[[node]], parents = fitted[node.parents]): wrong dimensions for node

I'm working on a neural network but I have problems when I try to associate probabilities to the network. The dataset is the asian network I've tried to change the node E dimensions, but I've still failed data <- read.table('survey.txt',header =…
fueeb
  • 11
  • 1
1
vote
0 answers

Getting INT_MAX error when trying to run bn.fit model on a Bayesian Network that I have modeled

I have built a Bayesian Belief network using the bnlearn package. It consists of 40 factor variables with factor levels ranging from 2 to 16. I created a manual bayesian graph using modelstring() and when I try and run bn.fit on the bayesian model,…
AnT
  • 19
  • 2
1
vote
0 answers

How to perfrom MAP estimation in a Bayesian Network in R?

I have to perform the Bayesian Network test, using MAP estimation (Maximum A Posteriori). I have a (gaussian) dataframe consisting of 5 variables, varying from 2 till 16 unique values per variable. Does anyone know who to set the arcs using the…
1
vote
1 answer

Probability of a record to belong to the same data-set given a Bayesian Network built with BNlearn

I'm trying to determine the probability of a new record to belong to an existing data-set. I'm using the BNlearn R package to build a Bayesian Network using a large training set. I then want to assess how anomalous a new record is. For this I want…
Michal T
  • 601
  • 5
  • 14
1
vote
0 answers

How is score of a NODE calculated in Hill Climb using bnlearn in R

I am working on my first assignment using bnlearn package to perform EDA. I have created a network using hill climb (hc) in R with all the default values. BUT there are few nodes in Bayesian Network which does NOT have any predecessor or successor…
1
vote
0 answers

Bnlearn error when using .sav database

I'm quite green regarding bayesian networks and bnlearn. I apologize in advance. I'm working on a database given by my PhD supervisor. When I'm exporting it from spss I get a different network to that exported from csv. Is this usual? It's the same…
msap
  • 11
  • 2
1
vote
0 answers

bnlearn in R - some conditional probability distributions of node probability do not sum to one

I am trying to reproduce a network i have previously created in GeNie, but i get an error that some conditional probability distributions of node probability do not sum to one. # create empty BN HazardNet <- empty.graph(nodes = c("scenario",…
user1607
  • 531
  • 7
  • 28
1
vote
1 answer

R bnlearn package error reassigning conditional probabilities

I am using the package bnlearn in R to construct a custom fitted, discrete Bayesian network using both data and expert knowledge. http://www.bnlearn.com/examples/custom/ This entails creating a bn.fit object using bn.fit() and modifying the local…
DRBG
  • 11
  • 2
1
vote
0 answers

Error with bnlearn argument: iamb(bn) or gs(bn)

I tried to create bayesian network with function iamb(x) and gs(x). But it showed "Error in check.data(x) : variable MFYield must have at least two levels." Here is my code, bn[sapply(bn, is.character)] <- lapply(bn[sapply(bn, is.character)],…
Wantidah
  • 21
  • 2
1
vote
0 answers

Error in bnlearn: variable has 5 levels but I get the error " variable arb_review must have at least two levels."

My data consists of 3 factor variables each with 5 levels. head(swiss_bn,n = 10) A tibble: 10 × 3 arb_review blocks stops 1 exploratory [1,2] (0,2] 2 exploratory (3,5] (0,2] 3 exploratory (2,3] (0,2] 4 …
JJ Levine
  • 11
  • 1
1
vote
0 answers

Is possible generate optimal parent sets in R using package bnlearn?

We could calculate the score of the bayesian network using the function "score", but I need calculate the score of all possible parents set from a node. I mean if I have n variables(X1,X2, X3, ..., Xn), I want calculate the score for X1 and all…
1
vote
1 answer

R bnlearn package: prevent node from having any parents

Using the package bnlearn, is it possible to set a node to not be able to have any parents? I've found it is technically possible using the blacklist function. Example preventing "A" from having any parents in the included test…
splicer
  • 11
  • 2
1
vote
1 answer

Error in bn.fit predict function in bnlear R

I have learned and fitted Bayesian Network in bnlearn R package and I wish to predict it's "event" node value. fl="data/discrete_kdd_10.txt" h=TRUE dtbl1 = read.csv(file=fl, head=h, sep=",") net=hc(dtbl1) fitted=bn.fit(net,dtbl1) I want to predict…
0
votes
0 answers

Enforce constraints in bayesian network such that all nodes have at least 1 outgoing arc

I have a question w.r.t generating bayesian network using bnlearn package in R. Is it possible to enforce a constraint in below line of code such that all nodes in the network has at least one outgoing arc (i.e. arc going out from a node to some…
Kumar
  • 43
  • 7