我在r中有以下示例数据框
a[::-1]
Count Year Hour Weekday day month week_of_month daycount w_y
23 2018 08 Wednesday 20 06 3 201 24
103 2018 12 Thursday 08 03 2 97 9
71 2018 09 Thursday 12 04 2 132 14
是我的目标变量,火车数据框的形状是Count
,测试是c(932,9)
我正在使用以下代码在R中的keras中训练神经网络模型
c(310,9)
当我运行上面的代码时,它给我以下错误,
model <- keras_model_sequential() model %>% layer_dense(units = 8, input_shape = c(9)) %>% layer_activation_leaky_relu() %>% layer_dropout(rate = 0.2) %>% layer_dense(units = 1) # output layer with linear activation model %>% compile(optimizer = "adam", loss = "mean_squared_error") ### Data preparation dataSplit = function(data, p = 0.75) { index = 1:nrow(data) index = sample(index) return(index[1:round(length(index) * p)]) } index = dataSplit(train_df) otrain = train_df[index, ] otest = train_df[-index, ] x_train <- otrain[,c(2:9)] y_train <- otrain$Count x_test <- otest[,c(2:9)] y_test <- otest$Count hist <- model %>% fit( x_train, y_train, batch_size = 10, epochs = 100 )
我在哪里犯错?与 Error in py_get_attr_impl(x, name, silent) :
AttributeError: 'list' object has no attribute 'dtype'
有关系吗?