I'm attempting to reverse engineer in Excel how the nnet package works using some simple input data. Here's the steps I've taken
Import dummy data:
test <- read.csv('dataScaled.csv',header=TRUE,sep = ",")Train the network:
anntrain <- nnet(Price ~ Sqft + Bedrooms + Bathrooms,test[1:650,],size=2, maxit=5000,linout=TRUE)Grab the weights of the ANN:
anntrain$wtsThis outputs:[1] -2.12443010 6.68900321 0.85338018 -0.73329823 -3.95336239 7.91917321 [7] -5.38893137 4.05941771 -0.02062346 0.26584364 0.32881035
Grab fitted values of trained network:
anntrain$fitted.valuesThis outputs what I believe to be the scaled Price predictions of the trained network for each of the 650 transactions I trained it on above.Prove out the fitted values by recalculating using the above weights using the sigmoid function.
My confusion is that it outputs 11 weight values. If I only have 3 inputs, 2 hidden nodes and 1 output, shouldn't that equate to only 8 weights? What are the 3 extra weights for?