R 在神经网络中获得恒定输出
我使用两个excel文件进行培训和测试。其中,我在两个excel文件中都有对应于高度的D值。 以下是我编写的代码:R 在神经网络中获得恒定输出,r,neural-network,backpropagation,R,Neural Network,Backpropagation,我使用两个excel文件进行培训和测试。其中,我在两个excel文件中都有对应于高度的D值。 以下是我编写的代码: library(neuralnet) library(readxl) traininginput <- read_excel("Training_Data.xlsx") net.D_value <- neuralnet(traininginput$D_value ~ traininginput$height,traininginput, hidden=3, thres
library(neuralnet)
library(readxl)
traininginput <- read_excel("Training_Data.xlsx")
net.D_value <- neuralnet(traininginput$D_value ~ traininginput$height,traininginput, hidden=3, threshold=0.01, rep = 100)
testdata <- read_excel("Test_data.xlsx")
net.test <- compute(net.D_value, testdata$height)
cleanoutput <- cbind(testdata$height,testdata$D_value,as.data.frame(net.test$net.result))
colnames(cleanoutput) <- c("height","Expected D_value","Neural Net D_value")
print(cleanoutput)
有谁能告诉我哪里出了问题,并帮助我编写正确的代码吗?规范您的
培训输入。神经网络对数字的大小非常敏感。我使用以下代码:你可能想做的正确测试数据:训练数据行问题解决了?规范化你的训练输入。神经网络对数字的大小非常敏感。我使用以下代码:你可能想做的正确测试数据:训练数据行问题解决了吗?
height Expected D_value Neural Net D_value
1 366.21 7.9599610 4.622364013
2 531.28 0.8100586 4.622364013
3 1005.37 2.7099610 4.622364013
4 1138.91 1.0595700 4.622364013
5 1199.37 0.7001953 4.622364013
6 966.48 13.3095700 4.622364013
7 398.41 32.5500500 4.622364013
8 674.71 1.3598630 4.622364013
9 662.16 20.3398400 4.622364013
10 841.57 2.0302730 4.622364013
11 1205.85 1.3603520 4.622364013
12 1289.47 7.0498050 4.622364013
13 954.32 0.6601563 4.622364013
14 396.73 14.0900900 4.622364013
15 1173.71 0.5400391 4.622364013
16 933.28 2.6503910 4.622364013
17 1658.32 14.6503900 4.622364013
18 1172.39 27.1201200 4.622364013
19 967.09 2.6298830 4.622364013
20 597.37 0.2797852 4.622364013