October 2017
Beginner to intermediate
572 pages
26h 1m
English
Perform the following steps to train the neural network with nnet:
> install.packages("nnet")
> library(nnet)
> data(iris)
> set.seed(2)
> ind = sample(2, nrow(iris), replace = TRUE, prob=c(0.7, 0.3))
> trainset = iris[ind == 1,]
> testset = iris[ind == 2,]
> iris.nn = nnet(Species ~ ., data = trainset, size = 2, rang = 0.1, decay = 5e-4, maxit = 200)
Output: # weights: 19 initial value 165.086674 iter 10 value 70.447976 iter 20 value 69.667465 iter 30 value 69.505739 iter 40 value 21.588943 iter 50 value 8.691760 iter 60 value 8.521214 iter 70 value 8.138961 iter 80 value ...Read now
Unlock full access