0

I have designed a NN with Keras and the code after defining the model are the following:

model.compile(optimizer= 'Adam',loss='mean_squared_error')
##callbacks
cb_checkpoint = ModelCheckpoint("model.h5", monitor='val_loss', save_weights_only=True,save_best_only=True, save_freq=1)
cb_Early_Stop=EarlyStopping( monitor='val_loss',patience=5)
cb_Reduce_LR = ReduceLROnPlateau(monitor='val_loss', factor=0.3, patience=5, verbose=0, mode='auto', min_delta=0.0001, 
                                 cooldown=0, min_lr=0)

callbacks = [cb_checkpoint,cb_Early_Stop,cb_Reduce_LR]
history = model.fit(
          x = {'inputsA': inputsA,  'inputsB': inputsB, 'inputsC': inputsC, 'inputsD': inputsD, 'input_site_id': site_id, 'input_building_id': building_id,  
               'input_meter': meter, 'input_primary_use': primary_use, 
                        'input_week': week, 'input_floor_count': floor_count, 'input_month': month, 'input_hour': hour} , y = {'predictions' : target}, batch_size = 16, epochs = 1000,
    validation_split = 0.1,
            callbacks=callbacks)

When I begin the fit process I get this kind of output during the first epoch:

Train on 1799857 samples, validate on 199985 samples
Epoch 1/1000
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
     16/1799857 [..............................] - ETA: 60:50:41 - loss: 77.3295WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
    112/1799857 [..............................] - ETA: 8:55:07 - loss: 112.8611WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
    208/1799857 [..............................] - ETA: 4:55:23 - loss: 87.5595 WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
    320/1799857 [..............................] - ETA: 3:17:30 - loss: 78.3782WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
    432/1799857 [..............................] - ETA: 2:29:53 - loss: 70.0334WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.
WARNING:tensorflow:Can save best model only with val_loss available, skipping.

I would like to suppress this output and get an update on the train and val loss at the end of each epoch only.

How can I achieve this?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
user8270077
  • 4,621
  • 17
  • 75
  • 140
  • There is no need to add `Your advice will be appreciated` to the footer of all of your questions. You've probably had ~100 removed by now. Remember that the editors that try to keep this place tidy are volunteers. We may be foolish for taking on the task, but we believe in this community, for all its many faults. We would rather not have to clean up after users who add redundant and conversational material wilfully. – halfer Nov 18 '19 at 20:41

1 Answers1

1

As written in keras documentation, if the inputs are generators or sequences , the validation_split will not work .

you can provide validation_data argument instead.

Tolik
  • 425
  • 4
  • 12
  • Thank you. In fact I am not providing sequences or use a generator. It is a multi-input model where each input is a row of a table with one or more columns. Moreover, the fit method produces in fact in the end of the epoch a validation score, so it seems that validation_split works. Finally, my question is how I can suppress the intermediate output and have instead one single line per epoch reporting the completion of the epoch and the loss. – user8270077 Nov 18 '19 at 09:46
  • in fit method, use verbose=2. – Tolik Nov 18 '19 at 09:50
  • Thank you, I wil try it and let you know. – user8270077 Nov 18 '19 at 09:54