Example of MLP Neural Network Modeling By Finding the Best Neural Network Weight Estimates From Nonlinear Regression Modeling

The neural network weight and bias estimates can also be determined by using the NLIN nonlinear procedure. The starting values to the parameter estimates can be calculated by standardizing the input variables, setting the output bias to the interval-valued target mean and setting the hidden-to-target bias to zero with a grid search performed to determine the remaining units and biases.

* standardizing the input variables from a standard normal dist with mean of

one and a variance of one;

proc standard data=dmddata out=standardout mean=0 std=1;

var x;

run;

* using the Levenberg-Marquardt method with a max. number of iteration at 500,

specifying a range of initial starting values to the weight estimates will

result in the NLIN procedure in evaluating each combination of the weight

estimates. The combination of weight estimates with the smallest sums-of-

squares error is used as the starting values;

proc nlin data=standardout method=marquardt maxiter=500;

params w0 = 20 w01=-.01,.01 /* initial starting weight estimates*/

w1 = 0 w11=-.01,.01; * where the bias is the target mean;

model y = w0 + w1*tanh(w01 + w11*x); * hyperbolic-tangent transformation;

run;

/* Data mining procedure to create a data mining DMDB data set and catalog */

proc dmdb data=sasdata out=dmddata dmdbcat=dmcdata;

var y x;

run;

/* The neural network SAS procedure for nonlinear regression modeling */

proc neural data=dmddata dmdbcat=dmcdata; * Read data mining data set;

input x / level=int; * input interval variable;

target y / level=int error=normal;

* target ordinal variable using a

Gaussian normal error function that is

the default error function for a

interval-valued target;

archi mlp hidden=1; * MLP architecture with one hidden layer;

train; * this statement must be specified to

train the network model and must be

placed after all neural network

modeling configuration statements;

score data=sasdata out=pred nodmdb; * Create a score output data set;

run;