Neural network in R
Let's load up the libraries that we need. We are going to use the neuralnet
package. The neuralnet
package is a flexible package that is created for the training of neural networks using the backpropagation method. We discussed the backpropagation method previously in this chapter.
Let's install the package using the following command:
install.packages("neuralnet")
Now, let's load the library:
library(neuralnet)
We need to load up some data. We will use the iris quality dataset from the UCI website, which is installed along with your R installation. You can check that you have it, by typing in iris at the Command Prompt. You should get 150 rows of data.
If not, then download the data from the UCI website, and rename the file to iris.csv
. Then, use the Import Dataset button on RStudio to import the data.
Now, let's assign the iris
data to the data
command. Now, let's look at the data to see if it is loaded correctly. It's enough to look at the first few rows of data, and...