NNET Procedure
Getting Started: NNET Procedure
Note: Input data must be in a CAS table that is accessible in your CAS session. You must refer to this table by using a two-level name. The first level must be a CAS engine libref, and the second level must be the table name. For more information, see the sections Using CAS Sessions and CAS Engine Librefs and Loading a SAS Data Set onto a CAS Server in Chapter 2, Shared Concepts.
This example shows how to use the NNET procedure to train a neural network to predict the type of iris plant. The iris data published by Fisher (1936) have been widely used for examples in discriminant and cluster analyses. The sepal length, sepal width, petal length, and petal width are measured in millimeters on 50 iris specimens from each of three species: Iris setosa, I. versicolor, and I. virginica. The data set is available in the Sashelp library.
You can load the sashelp.iris data into your CAS session libref by naming your CAS engine libref in the first statement of the following DATA step:
data mylib.iris;
set sashelp.iris;
run;
These statements assume that your CAS engine libref is named mylib, but you can substitute any appropriately defined CAS engine libref.
The following statements run PROC NNET and output the results to ODS tables:
proc nnet data=mylib.iris;
input SepalLength SepalWidth PetalLength PetalWidth;
target Species / level=nominal;
hidden 2;
train outmodel=mylib.nnetModel_gs seed=635117188;
partition fraction(validate=0.3 seed=103873735);
run;
Figure 1 shows the model information for the neural network.
Figure 1: Model Information
| Model Information | |
|---|---|
| Model | Neural Net |
| Number of Observations Used | 106 |
| Number of Observations Read | 106 |
| Target/Response Variable | Species |
| Number of Nodes | 9 |
| Number of Input Nodes | 4 |
| Number of Output Nodes | 3 |
| Number of Hidden Nodes | 2 |
| Number of Hidden Layers | 1 |
| Number of Weight Parameters | 14 |
| Number of Bias Parameters | 5 |
| Architecture | MLP |
| Seed for Initial Weight | 635117188 |
| Optimization Technique | LBFGS |
| Number of Neural Nets | 1 |
| Objective Value | 1.7965117949 |
| Misclassification Rate for Validation | 0.0909 |
Figure 2 shows the misclassification rate for the training sample.
Figure 2: Score Information for Training Data
| Score Information for Training | |
|---|---|
| Number of Observations Read | 106 |
| Number of Observations Used | 106 |
| Misclassification Rate | 0.1321 |
Figure 3 shows the misclassification rate for the validation sample.
Figure 3: Score Information for Validation Data
| Score Information for Validation | |
|---|---|
| Number of Observations Read | 44 |
| Number of Observations Used | 44 |
| Misclassification Rate | 0.0909 |