Using neural networks for regression
The nnet
package contains functionality to build neural network models for classification as well as prediction. In this recipe, we cover the steps to build a neural network regression model using nnet
.
Getting ready
If you do not already have the nnet
, caret
, and devtools
packages installed, install them now. If you have not already downloaded the data files for this chapter, download them now and ensure that the BostonHousing.csv
file is in your R working directory. We will build a model to predict MEDV
based on all of the remaining variables.
How to do it...
To use neural networks for regression, follow these steps:
- Load the
nnet
andcaret
packages:> library(nnet) > library(caret) > library(devtools)
- Read the ...
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.