Borrar filtros
Borrar filtros

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

12 visualizaciones (últimos 30 días)
Bezalem Eshetu Yirdaw
Bezalem Eshetu Yirdaw el 18 de Sept. de 2022
Respondida: Chunru el 18 de Sept. de 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.

Respuesta aceptada

Chunru
Chunru el 18 de Sept. de 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)

Más respuestas (0)

Categorías

Más información sobre Networks en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by