R bnlearn Grow-Shrink structure learning returns undirected graph -


the nagarajan et al. book (bayesian networks in r, o'reilly 2013, p. 35) says when take marks dataset of r bnlearn package , ask learn structure using grow-shrink implementation writing

library(bnlearn) data(marks) bn.gs = gs(marks) 

then should obtain directed graph:

model: [stat][anl|stat][alg|anl:stat][vect|alg] [mech|vect:alg] nodes: 5 arcs: 6 undirected arcs: 0 directed arcs: 6 

instead of undirected graph:

model: [undirected graph] nodes: 5  arcs: 6  undirected arcs: 6  directed arcs: 0  

even when add option undirected=false gs method, still same result. doing wrong? or there bug in r implementation? have tried both on mac , on debian machine, result same...

the answer provided authors on web site (which discovered): http://www.bnlearn.com/book-user/

“page 35: bnlearn 3.2 , later versions more picky setting arc directions; result bn.gs undirected graph , must extended dag cextend() conclude example.”

in other words, replace last line of code by

bn.gs = cextend(gs(marks)) 

it pity springer not provide standard service errata, does, example, o'reilly. authors of book had create own web site, , took time find it...


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -