我正在尝试跑步nnet
。它不断给出一个致命错误,冻结 r 并且必须重新启动 R 环境。我想知道 nnet 是否有限制,或者我的代码是错误的。我的数据如下。
str(data1)
'data.frame': 40749 obs. of 31 variables:
$ station_nbr: chr "1" "1" "1" "1" ...
$ date : Date, format: "2012-01-01" "2012-01-02" ...
$ store_nbr : chr "1" "1" "1" "1" ...
$ units : int 0 0 0 0 0 0 0 0 0 0 ...
$ tmax : num 52 50 32 28 38 46 57 45 39 47 ...
$ tmin : num 31 31 11 9 25 25 28 27 23 29 ...
$ tavg : num 42 41 22 19 32 36 43 36 31 38 ...
$ dewpoint : int 36 26 4 -1 13 21 28 22 12 24 ...
$ wetbulb : int 40 35 18 14 25 29 36 32 25 32 ...
$ heat : num 23 24 43 46 33 29 22 29 34 27 ...
$ cool : num 0 0 0 0 0 0 0 0 0 0 ...
$ snowfall : num 0 0 0 0 0 NA 0 0 0 0 ...
$ preciptotal: num 0.05 0.01 0 0 0 0.005 0 0 0 0.005 ...
$ stnpressure: num 29.8 29.4 29.7 29.9 29.7 ...
$ resultspeed: num 3.6 9.8 10.8 6.3 6.9 0.3 3 5.1 2.3 5.4 ...
$ avgspeed : num 4.6 10.3 11.6 8.3 7.8 2.4 3.6 6.6 4 6.5 ...
$ event : chr "0" "0" "0" "0" ...
$ RA : Factor w/ 2 levels "0","1": 2 1 1 1 1 1 1 1 1 1 ...
$ BR : Factor w/ 2 levels "0","1": 2 1 1 1 1 1 1 1 1 1 ...
$ FZ : Factor w/ 2 levels "0","1": 2 1 1 1 1 1 1 1 1 1 ...
$ FG : Factor w/ 2 levels "0","1": 2 1 1 1 1 1 1 1 1 1 ...
$ SN : Factor w/ 2 levels "0","1": 1 1 1 1 1 2 1 1 1 1 ...
$ TS : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ DZ : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ BL : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ DU : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ SQ : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ FU : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ GR : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ GS : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ weekdays : Factor w/ 8 levels "holiyday","Friday",..: 6 1 8 4 3 2 7 6 5 8 ...
和 nnet 代码是
library(nnet)
neural.mod = nnet(f, data = data1 , size = c(5,5), decay = 0.001, maxit = 100, rang = 0.05)
其中 f 是
f
units ~ station_nbr + date + store_nbr + tmax + tmin + tavg +
dewpoint + wetbulb + heat + cool + snowfall + preciptotal +
stnpressure + resultspeed + avgspeed + event + RA + BR +
FZ + FG + SN + TS + DZ + BL + DU + SQ + FU + GR + GS + weekdays
在 Rstudio 中给出错误,控制台上没有任何错误消息。