Bayesian Network K2 algorithm to find maximum likelihood.
2 ビュー (過去 30 日間)
古いコメントを表示
Hii All
I am using K2 algorithm of Bayesian Network praposed by Cooper and Harkovitz (1992).
I found the codes developed by Guangdi Li for learning DAG structure.
The code is running perfect (thanks to Li). I have to make little adjustments according to my requirment.
So, here is the issue.
The code suggested by Li is below.
clear all
clc
% data = csvread ('UC1_FGC_Women_zeros.csv');
% save ('Sample_1.mat', 'data')
% ControlCentor
% when you test the code, please correct the directory in next command
load ( 'C: \ Users \ ashwa \ Desktop \ aitec \ Work \ DIAMOND \ Task-2 \ MATLAB for Bayes \ K2 \ Sample_1.mat' );
% Sample is a variable that saves our training database.
LGObj = ConstructLGObj (Sample_1); % construct an object
% Order = [3 4 1 2 5 8 7 10 9 6]; % Order is the ordering of the input in K2 algorithm
Order = 1: 143;
u = 20; % u is the maximum edges of node in output graph.
[DAG, K2Score] = k2 (LGObj, Order, u);
h = view (biograph (DAG));
I have to make adjustmet for the "Order". I need that order must be generated randomly and perform 5000 iteration and then search the maximum liklyhood network from those 5000 iterations
So, to randomize the order, i have written
Order = reshape (randperm (LGObj.VarNumber), 1, length (randperm (LGObj.VarNumber)));
. It is working fine. No issues here. If I repalce the order in Li's code with this one, I will get a graph with randomly generated order.
Now I want to repeat this process altleast 5000 times and I need my output as a DAG matrix which have maximum sum (K2Score).
Thank you very much in advance.
Regards
Ashwani
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!