R Keras EarlyStopping cannot coerce type environment to vector of type integer

145 views Asked by At

Developing a Deep Learning with R Keras, and I want to implement earlystopping callback but it displays an error: Error in as.integer(verbose) : cannot coerce type 'environment' to vector of type 'integer'

The R code:

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

history <- model %>% 
  fit(x_train,
      y_train,
      epoch = 250,
      batch_size = 32,
      callback_early_stopping(monitor = "val_loss", 
                              min_delta = 0.001, 
                              patience = 5,
                              restore_best_weights = TRUE,
                              verbose = 1),
      validation_split = 0.2
      )

Any idea what's wrong? Thanks.

0

There are 0 answers