我正在使用两个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, 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
任何人都可以指导我出错的地方并帮我写出正确的代码吗?