2

In the book "Bayesian Networks in R", the authors learn the structure of the marks data set using the Grow - Shrink implementation. Should I expect the gs function to give different outputs for the learned structure? Perhaps maybe just learn a structure from within the equivalence class?

What's confusing me is that I run the code below and I get the output:

Bayesian network learned via Constraint-based methods

  model:
    [undirected graph]
  nodes:                                 5 
  arcs:                                  6 
    undirected arcs:                     6 
    directed arcs:                       0 
  average markov blanket size:           2.40 
  average neighbourhood size:            2.40 
  average branching factor:              0.00 

  learning algorithm:                    Grow-Shrink 
  conditional independence test:         Pearson's Correlation 
  alpha threshold:                       0.05 
  tests used in the learning procedure:  80 

but in the book, they claim to get a directed graph

Bayesian network learned via Constraint-based methods

  model:
    [STAT][ANL|STAT] [ALG|ANL:STAT] [VECT|ALG] [MECH|VECT:ALG]
  nodes:                                 5 
  arcs:                                  6 
    undirected arcs:                     0 
    directed arcs:                       6 
  average markov blanket size:           2.40 
  average neighbourhood size:            2.40 
  average branching factor:              1.20 

  learning algorithm:                    Grow-Shrink 
  conditional independence test:         Pearson's Correlation 
  alpha threshold:                       0.05 
  tests used in the learning procedure:  32
  optimized                              TRUE

According to what's included in the book, the only code they ran was

bn.gs = gs(marks)
bn.gs

The code that I ran was

library(bnlearn)
bn_gs = gs(marks)
bn_gs

What could possibly be different?

astudent
  • 37
  • 1
  • 7
  • 1
    I don't think the `gs` algorithm has a stochastic element - unless perhaps using a permutation test??. But I wouldn't worry too much about matching the book - code is changed (no optimized), different defaults etc over time or a line could be omitted from the book. You can make the graph directed using `cextend(bn.gs)` which matches the books graph, (but still the number of tests do not match) – user20650 Aug 22 '19 at 18:22

0 Answers0