# NOT RUN {
# Train a neural network on the iris dataset
X <- iris[,1:4]
y <- iris$Species
NN <- neuralnetwork(X, y, hidden.layers = 10, sgd.momentum = 0.9,
learn.rates = 0.01, val.prop = 0.3, n.epochs = 100)
# Plot training and validation loss during training
plot(NN)
# Continue training for 1000 epochs
train(NN, X, y, n.epochs = 200, val.prop = 0.3)
# Again plot the loss - note the jump in the validation loss at the 100th epoch
# This is due to the random selection of a new validation set
plot(NN)
# }
Run the code above in your browser using DataLab