The SCORE statement creates output data sets. The DATA= option specifies
the data set you want to score. The OUTFIT= option creates a data set containing
fit statistics.
score data=sampsio.dmtbase outfit=netfit
The OUT=option identifies the output data for predicted values and residuals.
The RENAME= option renames the variables in the OUT= data set containing predicted
values and residuals.
out=netout(rename=(p_logsal=predict r_logsal=residual));
title 'NN:1 Hidden Unit, Direct Connections,
and Reduced Input Set';
run;
PROC PRINT lists selected variables from the OUTFIT= data set.
proc print data=netfit noobs label;
where _name_ = 'LOGSALAR';
var _iter_ _pname_ _tmse_ _trmse_ _tmax_;
title 'Partial Listing of the Score OUTFIT= Data Set';
run;
PROC GPLOT plots diagnostic plots for the scored data set.
proc gplot data=netout;
plot logsalar*predict / haxis=axis1 vaxis=axis2;
symbol c=black i=none v=dot h=3 pct;
axis1 c=black width=2.5;
axis2 c=black width=2.5;
title 'Diagnostic Plots for the Scored Test Baseball Data';
plot residual*predict / haxis=axis1 vaxis=axis2;
run;
quit;
The NEURAL Procedure
Example 3: Neural Network Hill-and-Plateau Example (Surf Data)
Features
Specifying input, hidden, and output layers
q
Scoring Data with the Score Statement
q
Outputting Fit Statistics
q
Plotting the Posterior Probabilities
q
This example demonstrates how to develop a neural network model for a continuous target. A multilayer perceptron architecture is employed
with 3 and then 30 hidden units. The example test data set is named SAMPSIO.DMDSURF (Surf Data). It contains the interval target HIPL,
and two interval inputs X1 and X2. The data set was artificially generated as a surface containing a hill and a plateau. The hill is easily learned
by an RBF architecture. The plateau is easily learned by an MLP architecture.
The SAMPSIO.DMTSURF data set is a test data set that is scored using the scoring formula from the trained model. The
SAMPSIO.DMDSURF and SAMPSIO.DMTSURF data sets and the SAMPIO.DMDSURF catalog are stored in the sample library.
Program: 3 Hidden Units
proc g3d data=sampsio.dmdsurf;plot x2*x1=hipl
/ grid side ctop=blue caxis=green
ctext=black zmin=-1.5 zmax=1.5;
title 'Plot of the Surf Training Data';
footnote 'Hill Plateau Response Surface';
run;
title 'Hill & Plateau Data';
%let hidden=3;
proc neural data=sampsio.dmdsurf
dmdbcat=sampsio.dmdsurf
random=789;
input x1 x2 / id=i;
target hipl / id=o;
hidden &hidden / id=h;
prelim 10;
train maxiter=1000 outest=mlpest;
score data=sampsio.dmtsurf out=mlpout outfit=mlpfit;
title2 "MLP with &hidden Hidden Units";
run;
proc print data=mlpfit noobs label;
var _tase_ _tasel_ _taseu_;
where _name_ ='HIPL';
title3 'Fit Statistics for the Test Data';
run;
proc gcontour data=mlpout;
plot x2*x1=p_hipl / pattern ctext=black coutline=gray;
pattern v=msolid;
legend frame;
title3 'Predicted Values';
footnote;
run;
proc g3d data=mlpout;
plot x2*x1=p_hipl / grid side ctop=blue
caxis=green ctext=black
zmin=-1.5 zmax=1.5;
run;
Output: 3 Hidden Units
PROC GCONTOUR Plot of the Surf Training Data
PROC Neural Output
Hill & Plateau Data
MLP with 3 Hidden Units
Iteration Pseudo-random Objective
number number seed function
0 789 0.04023
1 761237432 0.03673
2 1092694980 0.04187
3 577625332 0.05216
4 261548896 0.03593
5 616485149 0.04030
6 692687363 0.03973
7 1510804008 0.04141
8 1385020003 0.03583
9 1070679467 0.04167
Hill & Plateau Data
MLP with 3 Hidden Units
Optimization Start
Parameter Estimates
------------------------------------------------------------------------------
Parameter Estimate Gradient Label
------------------------------------------------------------------------------
1 X1_H1 6.064004 -2.6744E-6 X1 -> H1
2 X2_H1 0.880274 5.28411E-6 X2 -> H1
3 X1_H2 0.048809 5.37355E-7 X1 -> H2
4 X2_H2 -4.988958 6.03873E-7 X2 -> H2
5 X1_H3 -5.916343 -6.0486E-6 X1 -> H3
6 X2_H3 0.730854 -0.0000207 X2 -> H3
7 BIAS_H1 -3.004936 -0.0000105 BIAS -> H1
8 BIAS_H2 1.791982 2.17127E-6 BIAS -> H2
9 BIAS_H3 0.864474 -0.0000126 BIAS -> H3
10 H1_HIPL -0.261095 0.0000179 H1 -> HIPL
11 H2_HIPL -0.484358 -0.0000107 H2 -> HIPL
12 H3_HIPL -0.265490 0.0000123 H3 -> HIPL
13 BIAS_HIP -0.490112 -0.0000182 BIAS -> HIPL
Value of Objective Function = 0.0358271766
Hill & Plateau Data
MLP with 3 Hidden Units
Levenberg-Marquardt Optimization
*** Termination Criteria ***
Minimum Iterations . . . . . . . . . . . . . . . -1
Maximum Iterations . . . . . . . . . . . . . . . 1000
Maximum Function Calls. . . . . . . . . . . . . . 2147483647
Maximum CPU Time . . . . . . . . . . . . . . . . 604800
ABSGCONV Gradient Criterion . . . . . . . . . . . 0.0000100
GCONV Gradient Criterion . . . . . . . . . . . . 1E-8
GCONV2 Gradient Criterion . . . . . . . . . . . . 0
ABSFCONV Function Criterion . . . . . . . . . . . 0
FCONV Function Criterion . . . . . . . . . . . . 0.0001000
FCONV2 Function Criterion . . . . . . . . . . . . 0
FSIZE Parameter . . . . . . . . . . . . . . . . . 0
ABSXCONV Parameter Change Criterion . . . . . . . 0
XCONV Parameter Change Criterion . . . . . . . . 0
XSIZE Parameter . . . . . . . . . . . . . . . . . 0
ABSCONV Function Criterion . . . . . . . . . . . -1.341E154
*** Other Control Parameters ***
Trust Region Initial Radius Factor . . . . . . . 1.00000
Singularity Tolerance (SINGULAR) . . . . . . . . 1E-8
Hill & Plateau Data
MLP with 3 Hidden Units
Levenberg-Marquardt Optimization
Scaling Update of More (1978)
Number of Parameter Estimates 13
Optimization Start: Active Constraints= 0 Criterion= 0.036
Maximum Gradient Element= 0.000 Radius= 1.000
Iter rest nfun act optcrit difcrit maxgrad lambda rho
1 0 2 0 0.0358 1.989E-7 0.00002 0 0.568
2 0 3 0 0.0358 1.764E-7 0.00002 0 0.698