The HPBNET Procedure

Example 4.6 Model Selection

This example uses Sampsio.Dmagecr, the German Credit sample data, to learn the best Bayesian network model among all network structures: naive, TAN, PC, and MB, with or without variable selection. PROC HPBNET also tries to choose the best value for the MAXPARENTS= option. About 30% of the input data is used for validation.

 proc hpbnet data=sampsio.dmagecr numbin=10 alpha=0.05
          structure=Naive TAN PC MB varselect=0 1 bestmodel;
     target Good_Bad;
     input  Checking History Purpose Savings Employed Installp Marital Coapp
            Resident Property Other Housing Existcr Job Depends Telephon
            Foreign/level=NOM;
     input Age Amount Duration/level=INT;
     partition FRACTION (VALIDATE=0.3);
     output network=network fit=fit validinfo=validinfo;
 run;

The following statements produce Figure 9, which shows the fit statistics, including the fact that 742 observations are used for training and 258 are used for validation. In the resulting network, there are 15 nodes, 15 links between the nodes, and the number of parameters is 129.

 proc print data=fit noobs label;
 run;

Figure 9: Model Selection: Fit Statistics

Number of
Observations
for Training
Number of
Observations
for Validation
Number
of Observations
Ignored
Sum of Frequencies
for Training
Sum of Frequencies
for Validation
Sum of
Frequencies
Ignored
Number
of Nodes
Number
of Links
Average
Degree
Maximum
Number
of Parents
in Network
Number of
Parameters
Score
74225807422580151522129-13179.18


The following statements produce Figure 10, which shows that PROC HPBNET has learned a PC Bayesian network structure. In the structure, Checking is the parent of Good_Bad, and Good_Bad is the parent of all the other input variables.

 proc print data=network noobs label;
     var _parentnode_ _childnode_;
     where _type_="STRUCTURE";
 run;

Figure 10: Model Selection: Best Structure

Parent NodeChild Node
checkinggood_bad
good_bademployed
good_badforeign
good_badhistory
good_badhousing
good_badmarital
good_badother
good_badproperty
good_badpurpose
good_badsavings
good_badtelephon
foreigntelephon
good_badage
good_badamount
good_badduration


The following statements produce Figure 11, which shows the validation results for each parameter combination. The PC Bayesian network structure has misclassified 68 observations out of 258 validation observations when MAXPARENTS is greater than or equal to 2 and VARSELECT=0. The TAN structure has 70 misclassification errors. The MB Bayesian network structure has 74 misclassification errors when MAXPARENTS is greater than or equal to 2. The naive Bayesian network has 76 misclassification errors.

 proc print data=validinfo noobs label;
     var _bestmodel_ _miserrors_ _structure_ _varselect_ _maxparents_;
 run;

Figure 11: Model Selection: Validation Information

Best ModelMisclassification
Errors
Input Parameter:
Structure
Input
Parameter:
Variable
Selection
Input
Parameter:
Maximum
Number
of Parents
YES68PC02
 68PC03
 68PC04
 68PC05
 70TAN02
 74MB32
 74MB33
 74MB34
 74MB35
 74PC12
 74PC13
 74PC14
 74PC15
 76PC01
 76NAIVE01
 76NAIVE02
 76NAIVE03
 76NAIVE04
 76NAIVE05
 85MB31
 85PC11
 85NAIVE11
 85NAIVE12
 85NAIVE13
 85NAIVE14
 85NAIVE15
 91TAN12


Last updated: May 25, 2022