# Example code for fitting the neural network. # This command tells S-Plus where to find the neural net library. # For example if you placed the nnet library in the C:/public folder # then you could use the form # library(nnet, first=T, lib.loc="C:/public") library(nnet, first=T) # Now attach the uva.nomiss dataframe attach(uva.nomiss) # Here is an example of how to use Nick's command # The command name is testnnet # The inputs go into the cbind function, # (cbind builds them into a matrix) # The output is as.factor(uva.nomiss$Newbie), which tells S-Plus # to treat Newbie as a categorical variable. # So to explore various architectures you can try and add or delete # variables in the cbind list, OR increase/decrease the size variable # which controls the number of units in the hidden layer. testnnet( cbind(uva.nomiss$Age/80, uva.nomiss$Income, uva.nomiss$Gender, uva.nomiss$Marital.Status), as.factor(uva.nomiss$Newbie), size=12, skip=T, decay=.0005, entropy=T)