Hi all, I have created a TAN network using bnlearn in R using the commands: TAN <- tree.bayes(training.data,"classFFB") fitted <- bn.fit(TAN,training.data,method="bayes") where training.data is a dataframe with 6 variables. I have produced a plot of the network using graphviz.plot: graphviz.plot(TAN) The graph shows arcs between each of the variables and the output node (classFFB) along with internal nodes showing parent/child relations between 4 nodes. However, when I look at the model in the TAN object and the conditional probabilities in the fitted object, there is only one direct arc leading to output node (classFFB) through a variable EST, all other relations act through that arc. Am I correct in interpreting that the all direct nodes except for EST->classFFB which are shown in the graphviz.plot are not retained once the model is trained. In which case, is there a way of showing the network after training? Thanks in advance Ross [[alternative HTML version deleted]]
Hi Ross, On 29 February 2016 at 08:46, <ross.chapman at ecogeonomix.com> wrote:> The graph shows arcs between each of the variables and the output node > (classFFB) along with internal nodes showing parent/child relations between > 4 nodes.Yes, that is as expected.> However, when I look at the model in the TAN object and the conditional > probabilities in the fitted object, there is only one direct arc leading to > output node (classFFB) through a variable EST, all other relations act > through that arc.I am not sure how that could possibly happen, could you share the print outut for a few nodes so that I can get some idea of what it is going on?> Am I correct in interpreting that the all direct nodes except for > EST->classFFB which are shown in the graphviz.plot are not retained once the > model is trained. In which case, is there a way of showing the network after > training?TAN does not do any sort of feature selection, so all the nodes should be there. As for "showing the network after training", what kind of plot are you looking for? Cheers, Marco -- Marco Scutari, Ph.D. Lecturer in Statistics, Department of Statistics University of Oxford, United Kingdom
Hi Marco Thanks for your quick response>-----Original Message----- >From: Marco Scutari [mailto:marco.scutari at gmail.com] >Sent: Monday, 29 February 2016 8:24 PM >To: ross.chapman at ecogeonomix.com >Cc: r-help <r-help at r-project.org> >Subject: Re: [R] bnlearn and TAN network > >Hi Ross, > >On 29 February 2016 at 08:46, <ross.chapman at ecogeonomix.com> wrote: >> The graph shows arcs between each of the variables and the output node >> (classFFB) along with internal nodes showing parent/child relations >> between >> 4 nodes. > >Yes, that is as expected. > >> However, when I look at the model in the TAN object and the > >conditional probabilities in the fitted object, there is only one >> direct arc leading to output node (classFFB) through a variable EST, >> all other relations act through that arc. > >I am not sure how that could possibly happen, could you share the print outut for a few nodes so that I can get some idea of what it is going on?When I look at the model in Tan I get this output:> TANBayesian network Classifier model: [classFFB][matureTreeData.ESTATE|classFFB][matureTreeData.YEAR|classFFB:matureTreeData.ESTATE][matureTreeData.SMG|classFFB:matureTreeData.ESTATE] [classNPKMg3YW_IN|classFFB:matureTreeData.YEAR][classHarvIntensity|classFFB:matureTreeData.YEAR] nodes: 6 arcs: 9 undirected arcs: 0 directed arcs: 9 average markov blanket size: 3.00 average neighbourhood size: 3.00 average branching factor: 1.50 learning algorithm: TAN Bayes Classifier mutual information estimator: Maximum Likelihood (disc.) training node: classFFB tests used in the learning procedure: 10 The output node is classFFB. My understanding is that the model only has one node linked directly to the output node: ][matureTreeData.ESTATE|classFFB]. Have I missed something here?> >> Am I correct in interpreting that the all direct nodes except for >> EST->classFFB which are shown in the graphviz.plot are not retained >> EST->once the >> model is trained. In which case, is there a way of showing the network >> after training?>TAN does not do any sort of feature selection, so all the nodes should be there. As for "showing the network after training", what kind of plot are you looking for?I was looking for a plot which shows the learned network, an example of which I have attached.>Cheers,> Marco -------------- next part -------------- A non-text attachment was scrubbed... Name: Rplotdemo.png Type: image/png Size: 6430 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20160229/7fa207b1/attachment.png>