I am trying to build a Learning Bayesian Network model to understand Traffic density. Traffic density is to be explained by variables Hour of day, Day of week, Weather condition & Accidents (y/n).

The Bayesian network model is correctly identifying that there is a relationship between Traffic Levels and the explanatory variables but the dependence is incorrect (judging from the direction of the arrows). However, when looking at the CPTs the probabilities seem to make sense. Is there anyway that I could get the model to naturally figure out the dependence? (without black/white listing).

I am using R. The package is "bnlearn". The algorithm is either going to be Hill-Climbing or Naive Bayes (as they say this is good for prediction).

The BN is attached

Thanks

Judah

#--------------------------R Code------------------

## data object called d2.

library(bnlearn)

nrow(d2)

## 75% of the sample size

smp_size <- floor(0.778271 * nrow(d2))

## set the seed to make your partition reproductible

set.seed(123)

train_ind <- sample(seq_len(nrow(d2)), size = smp_size)

train <- d2[train_ind, ]

test <- d2[-train_ind, ]

nrow(train)

nrow(test)

b1 = tree.bayes(train,"Traffic_Level") # learn BN structure on training set

data

b2 = hc(train)

b1fitted = bn.fit(b1, train, method = "bayes")

plot(b1)

b1

b1fitted