I am new to R, and I am trying to execute some simple code, which uses the neuralnet
package with the built-in dataset Iris.
library(neuralnet)
data(iris)
#Add a "fake" class to allow for all factors
levels(iris$Species) <- c(levels(iris$Species),"fake")
#Relevel to make the fake class the factor
iris$Species <- relevel(iris$Species,ref = "fake")
#Create dummy variables and remove the intercept
iris_multinom <- model.matrix(~Species+Sepal.Length+
Petal.Length+Petal.Width,
data=iris)[,-1]
colnames(iris_multinom)[1:3] <- c("setosa","versicolor","virginica")
nn_multi <- neuralnet(setosa+versicolor+virginica~
Sepal.Length+Petal.Length+Petal.Width,
data=iris_multinom,hidden=5,lifesign = "minimal",
stepmax = 1e+05,rep=10)
print(nn_multi)
However, when I print the neural network (print(nn_multi)
), I get a lot of information, which is in this format:
However, I would like my output to have this format (this is an example with 5 repetitions):
Any help would be highly appreciated.