R-Keras-val_loss为何不作图

时间:2018-07-07 08:15:21

标签: r machine-learning keras

我第一次和Keras一起玩。我尝试运行模型,看看损失和准确性。由于某种原因,它没有绘制val_loss的损失。

我的代码:

model <- keras_model_sequential() %>% 
  layer_dense(units = 256, activation = "relu", input_shape = dim(train.X)[[2]]) %>% 
  layer_dropout(rate = 0.4) %>% 
  layer_dense(units = 128, activation = "relu") %>%
  layer_dropout(rate = 0.3) %>% 
  layer_dense(units = 1, activation = "sigmoid")


model %>% compile (
  optimizer = "rmsprop", #configuring optimizer = optimizer_rmsprop(lr = 0.001)
  loss = "binary_crossentropy", #custom loss -> loss_binary_crossentropy
  metrics = c("accuracy") #metric_binary_accuracy
) 

history <- model %>% fit(
  train.X,
  train.Y,
  epochs = 100,
  batch_size = 64,
  validation_data = list(x_val, y_val)
)

我的结果: enter image description here

如果有人可以向我解释为什么val_loss函数没有绘制,我将非常感谢。

0 个答案:

没有答案