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

The NNET Procedure

Model Information
ModelNeural Net
Number of Observations Used106
Number of Observations Read106
Target/Response VariableSpecies
Number of Nodes9
Number of Input Nodes4
Number of Output Nodes3
Number of Hidden Nodes2
Number of Hidden Layers1
Number of Weight Parameters14
Number of Bias Parameters5
ArchitectureMLP
Seed for Initial Weight635117188
Optimization TechniqueLBFGS
Number of Neural Nets1
Objective Value1.7965117949
Misclassification Rate for Validation0.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 Read106
Number of Observations Used106
Misclassification Rate0.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 Read44
Number of Observations Used44
Misclassification Rate0.0909


Last updated: August 06, 2026