我正在尝试使用以下数据集(小部分)在 R 中训练神经网络
Age Salary Mortrate Clientrate Savrate PartialPrate
[1,] 62 2381.140 0.047 7.05 3.1 0
[2,] 52 1777.970 0.047 6.10 3.1 0
[3,] 53 2701.210 0.047 6.40 3.1 0
[4,] 52 4039.460 0.047 7.00 3.1 0
[5,] 56 602.240 0.047 6.20 3.1 0
[6,] 43 2951.090 0.047 6.80 3.1 0
[7,] 49 4648.860 0.047 7.50 3.1 0
[8,] 44 3304.110 0.047 7.10 3.1 0
[9,] 56 1300.000 0.047 6.10 3.1 0
[10,] 50 1761.440 0.047 6.95 3.1 0
如果我尝试对上面的一小部分数据执行此操作,则代码有效,但是如果我获取更多数据,则会neuralnet()
出现错误:
Neuralnet error Error in x - y : non-conformable arrays.
这个错误是什么意思,我该如何解决?
代码:
trainingsoutput <- AllData$PartialPrepay
trainingdata <- cbind(AllData$LEEFTIJD, AllData$MEDSAL2, AllData$rate5Y,
AllData$CRate, AllData$SavRate, trainingsoutput)
dimnames(trainingdata) <- list(NULL,
c("Age","Salary","Mortrate","Clientrate",
"Savrate","PartialPrate"))
nn <- neuralnet(PartialPrate ~ Age + Salary + Mortrate + Clientrate + Savrate,
data = trainingdata ,hidden=3, err.fct="sse", threshold=0.01)