How do I plot a Bayesian network graph in my way?

4 vues (au cours des 30 derniers jours)
Bezalem Eshetu Yirdaw
Bezalem Eshetu Yirdaw le 18 Sep 2022
Réponse apportée : Chunru le 18 Sep 2022
Dear Matworks community,
I am working on multilevel Bayesian network using matlab, I created functions to calculate the score and get the final adjecency matrix. what I want to do is how to plot the Bayesian network using my adjecency matrix that keep the flow of multilevel structure. Assume, g1 and g2 are level 3 and level 2 clustering variables, respectivelly and I have 5 variables at level 1, i.e., (y1, y2, y3, y4 and y5). let the final adgecency matrix would be
DAG = [0 0 1 0 1 1 0; 0 0 1 1 0 0 1; 0 0 0 1 1 0 0 ; 0 0 0 0 0 1 0; 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 ; 0 0 0 0 1 1 0], assume the corresponding row and column name of this matrix is (g1,g2,y1,y2,y3,y4,y5) and the rows are parents and the columns are children. So, is there any ways to plot a DAG as shown below please. Could you provide a code or matlab toolbox to plot such kind of DAG please. I realy apreciate your answers. Thank you.

Réponse acceptée

Chunru
Chunru le 18 Sep 2022
DAG = [0 0 1 0 1 1 0; 0 0 1 1 0 0 1; 0 0 0 1 1 0 0 ; 0 0 0 0 0 1 0; 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 ; 0 0 0 0 1 1 0],
DAG = 7×7
0 0 1 0 1 1 0 0 0 1 1 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0
%assume the corresponding row and column name of this matrix is (g1,g2,y1,y2,y3,y4,y5)
nn = ["g1","g2","y1","y2","y3","y4","y5"];
G = digraph(DAG, nn);
plot(G)

Plus de réponses (0)

Catégories

En savoir plus sur Networks dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by