Step 1 loads the packages needed and step 2 reads the data.
Step 3 converts the outcome variable class to a factor. For nnet to perform classification, we need the outcome variable to be a factor. If you have predictor variables that are really categorical but have numeric values, convert them to factors so that nnet can treat them appropriately. As we have only numeric predictor variables, we need not do anything for the predictor variables.
Step 4 partitions the data. See Creating random data partitions in Chapter 2, What's In There? - Exploratory Data Analysis, for more details on this step.
Step 5 builds the neural network model. We pass the formula and dataset as the first two arguments:
- The size argument specifies the ...