3

I am new to Keras and trying to implement a neural network machine learning model. The input tensor looks like (X1, X2) and outputs (Y). Note X1 and X2 are correlated. In the model, only X1 will be used for training, but both X1 and X2 will be passed to the loss function that is a function of X1, X2, y_pred and y_true. Below is a pseudocode for loss function.

def customLossFunctionWrapper(input_tensor):
    def LossFunction(y_pred, y_true):
        loss_value = f(X1, X2, y_pred, y_true)
        return loss_value.

My question is different from Keras custom loss function: Accessing current input pattern. I need to mask part of input_tensor in training model but use the masked part in the loss function. Can anyone offer me some idea? Thank you in advance.

stclair
  • 31
  • 2
  • Possible duplicate of [Keras custom loss function: Accessing current input pattern](https://stackoverflow.com/questions/46464549/keras-custom-loss-function-accessing-current-input-pattern) – today Jul 29 '18 at 06:01

0 Answers0