+ Reply to Thread
Results 1 to 2 of 2

Thread: Bayesian Network - Dependency Direction

  1. #1
    Points: 33, Level: 1
    Level completed: 66%, Points required for next Level: 17

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bayesian Network - Dependency Direction




    Hi There,

    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
    Attached Images  

  2. #2
    Points: 33, Level: 1
    Level completed: 66%, Points required for next Level: 17

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bayesian Network - Dependency Direction


    After further digging, I found that Learning Bayesian networks, at times:

    1. may not learn all the “expected” edges, and
    2. may learn in the wrong direction

    Hence, I eventually had to whitelist & blacklist (basically a function that allows you to either force onto or remove relationships between nodes within the bnlearn package in R). I was hoping for these relationships to emerge naturally.

    Ofer Mendelevitch is an expert in this area, please watch the youtube video below for a quick intro of Bayesian networks in R and the real world...

    https://www.youtube.com/watch?v=S_EN_-3peHs

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats