2
votes

I want to train a model with one input and two outputs in Keras, but I have a couple of issues with the setup of validations.

1) The Keras functional API documentation says that model.fit can take in a list of numpy arrays as output when there are multiple outputs. However, for the validation_data argument to model.fit, it says that the model can take in a tuple of the form (x_val, y_val) or (x_val, y_val, val_sample_weights). Then how can I pass in the y_val of my second output? Would I be able to do that using validation_split or would validation split also only be applied to one of my outputs?

2) Also what is the validation loss that is passed to the EarlyStopping Callback going to be? For the losses that are returned by functions like model.evaluate, two loss values will be returned. For training, the sum of the losses times their weights will be minimized. How does this this work with EarlyStopping? I want the early stopping to also be based on the minimization of the sum of losses times their weights, but I don't know if this is what will actually happen.

1

1 Answers

1
votes
  1. It's specified that both y_train and y_val might be a list of numpy.arrays. From my experience val_split should work fine.

  2. The final loss is a sum of all model losses and it's used in purpose to check EarlyStopping criterion.