The HP4SCORE Procedure

Example 3.1 Fit Statistics

The following statements run PROC HP4SCORE and compute the misclassification rate of the scored output. Before SAS Enterprise Miner 14.1, the target values from the input data set had to be merged with the predictions in the scored output before fit statistics were computed. This is not necessary with SAS Enterprise Miner 14.1 and later.

filename outmodel "C:\Temp\HPForestModel";
proc HPFOREST data=sampsio.hmeq;
   input CLAge CLNo Loan MortDue Value YoJ DebtInc/level=interval;
   input Bad Delinq Derog nInq Reason/level=nominal;
   target Job/level=nominal;
   ods output FitStatistics=fitstats;
   save file=outmodel;
quit;

Output 3.1.1 shows that the program ran locally and that four threads were used. The default number of threads is the number of processor cores in the computer. The listing also shows the values of the training parameters, the number of observations read (5,960), and the number of observations used in training (5,681). A total of 279 observations are missing the target value and are excluded from training.

Output 3.1.1: Output from PROC HPFOREST

The HPFOREST Procedure

Performance Information
Execution ModeSingle-Machine
Number of Threads16

Data Access Information
DataEngineRolePath
SAMPSIO.HMEQV9InputOn Client

Model Information
ParameterValue 
Variables to Try3(Default)
Maximum Trees100(Default)
Actual Trees100 
Inbag Fraction0.6(Default)
Prune Fraction0(Default)
Prune Threshold0.1(Default)
Leaf Fraction0.00001(Default)
Leaf Size Setting1(Default)
Leaf Size Used1 
Category Bins30(Default)
Interval Bins100 
Minimum Category Size5(Default)
Node Size100000(Default)
Maximum Depth20(Default)
Alpha1(Default)
Exhaustive5000(Default)
Rows of Sequence to Skip5(Default)
Split Criterion.Gini
Preselection Method.Loh
Missing Value Handling.Valid value

Number of Observations
TypeN
Number of Observations Read5960
Number of Observations Used5681


Output 3.1.2 shows the baseline fit statistics.

Output 3.1.2: Baseline Fit Statistics Output

Baseline Fit Statistics
StatisticValue
Average Square Error0.121
Misclassification Rate0.580
Log Loss1.460


The following statements print the first 10 observations of the table of fit statistics, which are shown in Output 3.1.3. The misclassification rate drops from 0.18835 to 0.02535 as the number of trees in the forest grows from 1 to 10.

proc print data=fitstats(obs=10);
run;

Output 3.1.3: First 10 Observations Fit Statistics Output

ObsNTreesNLeavesPredAllPredOobMiscAllMiscOobLogLossAllLogLossOob
116650.05120.08880.203310.3262.0204.605
2213470.03300.08120.127440.3090.5673.929
3320360.02790.07620.082030.2880.3913.407
4427820.02520.07270.055800.2800.3322.970
5535300.02300.06930.041890.2720.3102.543
6642620.02110.06450.031330.2530.2962.173
7749170.02090.06150.028520.2450.3001.778
8856490.02020.05870.023940.2330.2961.546
9963840.01960.05680.022360.2240.2921.374
101071120.01920.05480.020420.2110.2901.242


The following statements print the final row of the table of fit statistics, which are shown in Output 3.1.4. The misclassification rate is 0.00334 in the final model.

proc print data=fitstats(firstobs=100);
run;

Output 3.1.4: Last Observation Fit Statistics Output

ObsNTreesNLeavesPredAllPredOobMiscAllMiscOobLogLossAllLogLossOob
100100705980.01640.04080.004930.1200.2800.541


The following code inputs the model that PROC HPFOREST created and outputs predictions for each observation in the input data set:


proc hp4score data=sampsio.hmeq;
   score file=outmodel out=scoreout3;
run;

Output 3.1.5 shows that PROC HP4SCORE was run with four threads; 5,960 observations were read and output even though 279 of them have a missing target value.

Output 3.1.5: Performance Information

The HP4SCORE Procedure

Performance Information
Execution ModeSingle-Machine
Number of Threads16

Data Access Information
DataEngineRolePath
SAMPSIO.HMEQV9InputOn Client
WORK.SCOREOUT3V9OutputOn Client

Number of Observations
TypeN
Number of Observations Read5960
Number of Observations Used5960
Sum of Frequencies Used5960


The following code computes the misclassification rate. Note that PROC MEANS excludes the observations that have missing target values.

   data score;
      set scoreout3;
      if upcase(JOB) ne upcase(I_JOB) then misclass=1;
      else misclass=0;
   run;
proc means data=score(where=(JOB ne ''));
   var misclass;
run;

Output 3.1.6 shows the output from PROC MEANS with a misclassification rate of 0.0033445, the same as in the fit statistics table from PROC HPFOREST.

Output 3.1.6: Output from PROC MEANS with Misclassification Rate

The MEANS Procedure

Analysis Variable : misclass
NMeanStd DevMinimumMaximum
56810.00492870.070037701.0000000


Last updated: May 25, 2022