Keras验证和损耗波动过度拟合

时间:2020-02-24 08:55:40

标签: r keras

我开发了一个深度学习模型,我想知道为什么我的验证损失和验证准确率会波动。这是过度拟合的标志吗?我尝试使用诸如退学和学习率之类的超参数。我有7个输入和2个输出。训练数据的大小约为57381。

model7 <- keras_model_sequential()
model7 %>% 
  layer_dense(units = 8,
              kernel_regularizer = regularizer_l2(0.001),
              activation = "relu",
              input_shape = c(7)) %>% 
  layer_dropout(rate = 0.2) %>% 
  layer_dense(units = 22,
              kernel_regularizer = regularizer_l2(0.001),
              activation = "relu") %>% 
  layer_dropout(rate = 0.2) %>% 
  layer_dense(units = 2,
              activation = "softmax")
summary(model7)

# Compiling the model
model7 %>% compile(loss = "categorical_crossentropy",
                   optimizer = "adam",
                   metrics = c("accuracy"))

history <- model7 %>% 
  fit(x_train,
      y_train,
      epoch = 200,
      batch_size = 64,
      validation_split = 0.2)

Keras model history

您能告诉我我是否过拟合,是否可以提出一些建议来修改我的模型?

0 个答案:

没有答案