sambofra / bnstruct

R package for Bayesian Network Structure Learning
GNU General Public License v3.0
17 stars 9 forks source link

max.fanin.layers #1

Closed sap01 closed 7 years ago

sap01 commented 7 years ago

Respected Dr. Sambo,

Package 'bnstruct' has been immensely helpful for my research. I am little confused about the input argument 'max.fanin.layers' used with 'sm' algorithm (sm.R). Let us assume that it is a matrix of dimension (n.layers, n.layers), where 'n.layers' represents number of layers in the input BNDataset. Q1. What does the cell (i,j) mean? Q2. Why do the upper triangular elements contain 'don't care' values?

Thank you for your precious time. Sincerely yours, Saptarshi Pyne

sambofra commented 7 years ago

Hi Saptarshi,

the max.fanin.layers codes (as the name goes), for each layer, the maximum amount of parents from each of the other layers. The interpretation is a little involute and is better explained by an example. Let's take a three-layer structure, with 5 nodes in the first layers, 3 in the second and 4 in the third, and a max.fanin.layers matrix like this

0 0 0 4 6 0 4 3 10

As you know, nodes in a layer can only have parents in the same or previous layers.

So, first row codes the maximum number of parents that nodes in the first layer can have: they can only have parents from the same layer and element (1,1) is 0, so nodes in the first layer can't have any parent.

Second row is for second layer: element (2,1) is 4, so node in layer 2 can have at most 4 parents from layer 1.

Third row is for third layer: elements in third layer can have at most 4 parents from layer 1 (el. (1,3)) and 3 parents from layer 2 (el. (2,3)).

The diagonal is special: it codes the maximum amount of parents a node in a layer can have from ALL layers, both the same and the previous layers. So nodes in layer two can have at most 6 parents and in layer 3 at most 10.

If you wonder why I used such a complex representation, I actually took it from the BNT matlab toolbox and it derives from the use of the Fast Upwards Moebius Transform, which is useful to quickly enumerate all possible parent/children combinations respecting a set of structural constraints.

I hope this clarifies the matter.

Best regards, Francesco

2017-06-14 13:58 GMT+02:00 Saptarshi Pyne notifications@github.com:

Respected Dr. Sambo,

Package 'bnstruct' has been immensely helpful for my research. I am little confused about the input argument 'max.fanin.layers' used with 'sm' algorithm (sm.R). Let us assume that it is a matrix of dimension (n.layers, n.layers), where 'n.layers' represents number of layers in the input BNDataset. Q1. What does the cell (i,j) mean? Q2. Why do the upper triangular elements contain 'don't care' values?

Thank you for your precious time. Sincerely yours, Saptarshi Pyne

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sambofra/bnstruct/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AFawEz7LK260cVtQmD57FjQOB4aS7G6iks5sD8rJgaJpZM4N5xxH .

sap01 commented 7 years ago

Respected Dr. Sambo,

Yes, now it is crystal clear. I would like to request you to include this example in the version 1.0.3 manual. Thank you for explaining the reason behind choosing this representation, as well. Thank you very much for your valuable time.

Sincerely yours, Saptarshi