フィルターのクリア

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

12 ビュー (過去 30 日間)
Bezalem Eshetu Yirdaw
Bezalem Eshetu Yirdaw 2022 年 9 月 18 日
回答済み: Chunru 2022 年 9 月 18 日
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.

採用された回答

Chunru
Chunru 2022 年 9 月 18 日
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)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNetworks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by