Learning the Parents and Children of a Bayesian Network Node
This demonstration illustrates the parents and children learning process of a node in the ALARM network.
Contents
Loading the True Network
First we load the ALARM network in the org.mensxmachina.bnet.Network object net.
% load ALARM network load mxm_bnet_alarm_net; % loads 'net' Network
Loading the Network Samples
Then we load samples from the ALARM network in dataset a.
% load ALARM network samples load mxm_bnet_alarm_samples; % loads 'a' dataset
Learning the Parents and Children of a Node from the Samples
We provide the samples as input to the org.mensxmachina.bnet.mmpc function in order to learn the parents and children of node #37. We don't set any parameter-value pairs so the defaults are used.
% learn parents and children set of variable #37
pc = org.mensxmachina.bnet.mmpc(a, 37)
Learning EPC(37)... Learning EPC(25)... Learning EPC(36)... pc = 25 36
Comparing the Learned Parents and Children Set with the True One
Now we compare the learned skeleton with the true Weather skeleton. First we obtain the skeleton of the Weather network by calling the skeleton method of the org.mensxmachina.bnet.Network class. Then we get a classification performance object with org.mensxmachina.bnet.pcperf and we print the sensitivity and specificity. org.mensxmachina.bnet.pcperf is a version of the classperf function in the Bioinformatics Toolbox (TM), specialized for skeleton learning. For a given node, the task of learning its parents and children can be viewed as a binary classification task, where each other node is classified as either parent or child, or not. Finally we plot the confusion matrix with the org.mensxmachina.bnet.plotpcconfusion function, which is a version of the plotconfusion function in the Neural Network Toolbox (TM) specialized for parents and children learning. We see that we learned the parents and children of node #37 correctly.
% get true skeleton skeleton_true = net.skeleton; % get classifier performance object for variable #37 cp = org.mensxmachina.bnet.pcperf(skeleton_true, pc, 37); % print sensitivity and specificity fprintf('\nSensitivity = %.2f%%\n', cp.sensitivity*100); fprintf('\nSpecificity = %.2f%%\n', cp.specificity*100); % plot confusion matrix for variable #37 org.mensxmachina.bnet.plotpcconfusion(skeleton_true, pc, 37);
Sensitivity = 100.00% Specificity = 100.00%
