September 2017
Beginner to intermediate
270 pages
5h 53m
English
To understand all the steps in the code just proposed, we will look at them in detail. First, the code snippet will be shown, and the explanation will follow.
library(NeuralNetTools)library(nnet)
This includes the libraries NeuralNetTools and nnet() for our program.
###Set working directory for the training datasetwd("C:/R")getwd()###Read the input filemydata=read.csv('RestaurantTips.csv',sep=",",header=TRUE)mydataattach(mydata)names(mydata)
This sets the working directory and reads the input CSV file.
##Train the model based on output from inputmodel=nnet(CustomerWillTip~Service+Ambience+Food, data=mydata, size =5, rang=0.1, decay=5e-2, maxit=5000)print(model)
This calls the nnet() function with ...