Hello,
I made an R code using caret to do a multi-class classification neural network.
I am able to achieve good classification results and able to predict new data with the neural network.
I want to get the weights of the neural network, in other words, I want to know how the neural network classifies the data in order to insert these weights on excel and make excel predict new data through the neural network weights.
I was able to get the weights from R using the neuralweights function. the output of the function is factors and I don't know how these predicts classes at the end. My classes are "on or below schedule" - "Late-major" - "late - minor" etc.
any help?
This is the Rcode:
#fit model
fit <- nnet(Status~.,data=data, size =6, decay= 0.0001, maxit = 500)
neuralweights(fit)
plotnet(fit)
#predictions
predictions <- predict(fit, data[,1:6], type = "class")
list(predictions)
list(data$Status)
#predicting tests
predictiontest <-predict(fit, datatest[,1:6], type = "class")
list(predictiontest)
library(caret)
confusionMatrix(as.factor(predictions), as.factor(data$Status))
These are the weights:
$struct
[1] 6 6 4
$wts
$wts$`hidden 1 1`
[1] -2.6590091 -7.1824542 0.4958755 0.8433498 8.2095521 2.4000397 -3.1055782
$wts$`hidden 1 2`
[1] -0.4194698 -7.8059757 -3.1148086 0.2468263 8.1757322 1.9420070 0.3023690
$wts$`hidden 1 3`
[1] 0.2573233 -0.7496363 0.6353437 -1.0495383 0.2317010 1.9741867 -2.0314975
$wts$`hidden 1 4`
[1] 0.02282316 0.20079435 0.19397557 0.21898944 0.24693248 0.15382270 0.24684709
$wts$`hidden 1 5`
[1] 0.1942839 -0.9739676 -0.4665476 1.2561668 1.0399035 3.4011882 -5.0683255
$wts$`hidden 1 6`
[1] 17.661462 -2.104310 1.610985 3.904200 -7.992500 -3.871134 5.083067
$wts$`out 1`
[1] 3.254789767 -13.827205640 6.822064728 0.003571207 3.251182730 -6.703624868 10.175074072
$wts$`out 2`
[1] -3.12855859 -1.07939139 -14.15440722 -0.01217096 -3.12799684 -0.13091726 35.75726368
$wts$`out 3`
[1] 2.713869 -0.118249 6.031388 11.196365 2.710654 -5.039395 -31.007136
$wts$`out 4`
[1] -2.839328 15.020478 1.303031 -11.189032 -2.837091 11.877274 -14.926057
thanks in advance