I define my model structure, and i determine its parameters that consist of the Conditional Probabilities Tables (CPT). in this part, i decide to use a machine learning algorithm that is able to define
Bayesian Network parameters given the relative structure and a data set for training.
my question here, is when i run my code, i receive this result and i don't undrestund it
this is my code to create the structure of my bayesien network and the definition of parameters
`%Specify the number of nodes:
N=14;
%Create a Direct Acyclic Graph (DAG) matrix:
dag=zeros(N,N);
%Assign for each node a number:
Imm=1; Ssat=2; Pat=3; Disci=4; ResAut=5; Ambpos=6; RNL=7; Prud=8; CompJAM1=9; CompJAM4=10; CompJAM6=11; CorrupM1=12; CorrupM4=13; CorrupM6=14;
%Establish the links between parent nodes and its children
dag(Imm ,CompJAM1)=1;
dag(Ssat,CompJAM1)=1;
dag(Pat,CompJAM1)=1;
dag(ResAut,CompJAM4)=1;
dag(Prud ,CompJAM4)=1;
dag(Ambpos,CompJAM6)=1;
dag(RNL ,CompJAM6)=1;
dag(Prud ,CompJAM6)=1;
dag(ResAut ,CompJAM6)=1;
dag(CompJAM1 ,CorrupM1)=1;
dag(CompJAM4 , CorrupM4)=1;
dag(CompJAM6,CorrupM6)=1;
%Specify the discrete nodes
discrete_nodes=1:N;
%Specify the number of values of each node:
node_sizes(1)=2;
node_sizes(2)=2;
node_sizes(3)=2;
node_sizes(4)=2;
node_sizes(5)=2;
node_sizes(6)=2;
node_sizes(7)=2;
node_sizes(8)=2;
node_sizes(9)=2;
node_sizes(10)=2;
node_sizes(11)=2;
node_sizes(12)=4;
node_sizes(13)=4;
node_sizes(14)=4;
%Specify the observed nodes
onodes=[1 2 3 4 5 6 7 8 9 10 11];
%Create the Bayesian Network model
bnet = mk_bnet(dag, node_sizes,'names',{'Imm','Ssat','Pat','Disci','ResAut','Ambpos','RNL','Prud','CompJAM1','CompJAM4','CompJAM6','CorrupM1','CorrupM4','CorrupM6'},'discrete', discrete_nodes,'observed',onodes);
%The BN parameters estimation
%Load numeric data from an ASCII text file that contains the training set
subplot()
data = load('dataa.txt');
%Create a cell array that will contain the dataset of the loaded file
ncases=size(data,1);
cases=cell(N,ncases);
cases([1 2 3 7 6 5 8 4 9 10 11 12 13 14],:)=num2cell(data');
%Create another cell array containing the data of the previous one.
transposed_cases=cell2num(cases);
%Definition of the CPD initially with random CPDs
seed = 0;
rand('state', seed);
for i=1:N
bnet.CPD{i}=tabular_CPD(bnet, i, 'prior_type', 'dirichlet', 'dirichlet_type', 'unif');
end
%Call the BNT learning parameters routine
bnet1=learn_params(bnet,transposed_cases);`
I define my model structure, and i determine its parameters that consist of the Conditional Probabilities Tables (CPT). in this part, i decide to use a machine learning algorithm that is able to define Bayesian Network parameters given the relative structure and a data set for training.
my question here, is when i run my code, i receive this result and i don't undrestund it
this is my code to create the structure of my bayesien network and the definition of parameters `%Specify the number of nodes: N=14; %Create a Direct Acyclic Graph (DAG) matrix: dag=zeros(N,N); %Assign for each node a number: Imm=1; Ssat=2; Pat=3; Disci=4; ResAut=5; Ambpos=6; RNL=7; Prud=8; CompJAM1=9; CompJAM4=10; CompJAM6=11; CorrupM1=12; CorrupM4=13; CorrupM6=14; %Establish the links between parent nodes and its children dag(Imm ,CompJAM1)=1; dag(Ssat,CompJAM1)=1; dag(Pat,CompJAM1)=1; dag(ResAut,CompJAM4)=1; dag(Prud ,CompJAM4)=1; dag(Ambpos,CompJAM6)=1; dag(RNL ,CompJAM6)=1; dag(Prud ,CompJAM6)=1; dag(ResAut ,CompJAM6)=1; dag(CompJAM1 ,CorrupM1)=1; dag(CompJAM4 , CorrupM4)=1; dag(CompJAM6,CorrupM6)=1; %Specify the discrete nodes discrete_nodes=1:N; %Specify the number of values of each node: node_sizes(1)=2; node_sizes(2)=2; node_sizes(3)=2; node_sizes(4)=2; node_sizes(5)=2; node_sizes(6)=2; node_sizes(7)=2; node_sizes(8)=2; node_sizes(9)=2; node_sizes(10)=2; node_sizes(11)=2; node_sizes(12)=4; node_sizes(13)=4; node_sizes(14)=4; %Specify the observed nodes onodes=[1 2 3 4 5 6 7 8 9 10 11];
%Create the Bayesian Network model bnet = mk_bnet(dag, node_sizes,'names',{'Imm','Ssat','Pat','Disci','ResAut','Ambpos','RNL','Prud','CompJAM1','CompJAM4','CompJAM6','CorrupM1','CorrupM4','CorrupM6'},'discrete', discrete_nodes,'observed',onodes); %The BN parameters estimation %Load numeric data from an ASCII text file that contains the training set subplot() data = load('dataa.txt'); %Create a cell array that will contain the dataset of the loaded file
ncases=size(data,1); cases=cell(N,ncases); cases([1 2 3 7 6 5 8 4 9 10 11 12 13 14],:)=num2cell(data'); %Create another cell array containing the data of the previous one. transposed_cases=cell2num(cases); %Definition of the CPD initially with random CPDs seed = 0; rand('state', seed); for i=1:N bnet.CPD{i}=tabular_CPD(bnet, i, 'prior_type', 'dirichlet', 'dirichlet_type', 'unif'); end %Call the BNT learning parameters routine bnet1=learn_params(bnet,transposed_cases);`