0
いくつかの値を返すために予測関数と一緒にnnet関数を使用しようとしていますが、nnet $ fitted.valuesは予測値と同じで、なぜ2つのデータセットが異なるのかわかりません予測とnnet関数
trainTest<- function(Train, Test)
{
nnetfit<- nnet(as.numeric(Train[,7])~ Train[,10]+Train[,15],data=Train,linout=TRUE,Hess=TRUE,maxit=1000,size=30,na.rm=TRUE)
predicted <-predict(nnetfit,Test[2:13,c(10,15)],na.rm=TRUE)
return(list(nnetfit$fitted.values,predicted))
}
EDIT:データを追加しましたが、あなたのpredict
声明で
> cbind(Train[,7],Train[,10],Train[,15])
[,1] [,2] [,3]
[1,] 75.59 NA 52
[2,] 77.84 -26.895809 45
[3,] 78.98 34.371298 38
[4,] 78.99 15.444714 31
[5,] 83.28 12.452137 24
[6,] 82.82 -33.920929 17
[7,] 84.50 8.855511 10
[8,] 85.34 30.744892 3
[9,] 85.08 -16.296103 68
[10,] 82.12 -9.209724 61
[11,] 80.85 33.632136 54
[12,] 83.62 -32.724031 47
> cbind(Test[2:14,10],Test[2:14,15])
[,1] [,2]
[1,] -6.951645 40
[2,] -2.581847 33
[3,] 7.264525 26
[4,] -46.483134 20
[5,] 88.103500 12
[6,] 39.473314 5
[7,] -12.413910 89
[8,] -12.961001 82
[9,] -21.355713 75
[10,] 15.221032 68
[11,] 17.508519 61
[12,] 8.811952 54
[13,] 18.064204 47