Using neural networks for classification

The nnet package contains the nnet function for classification using neural networks.

Getting ready

If you have not already installed the nnet and caret packages, install them now. Download the data files for this chapter from the book's website and place the banknote-authentication.csv file in your R working directory. We will use class as our target or outcome variable, and all the remaining variables as predictors. Using Neural Networks requires all the independent/predictor variables to be numeric and the dependent variable or outcomes to be 0-1. However, the nnet function does all the work of generating dummies (contrasts) and correctly handles categorical outcome variables.

How to do it...

To use Neural ...

Get R: Recipes for Analysis, Visualization and Machine Learning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.