def build_masked_loss(loss_function, mask_value):
def masked_loss_function(y_true, y_pred):<EOL><INDENT>mask = K.cast(K.not_equal(y_true, mask_value), K.floatx())<EOL>return loss_function(y_true * mask, y_pred * mask)<EOL><DEDENT>return masked_loss_function<EOL>
Builds a loss function that masks based on targets

    Args:
        loss_function: The loss function to mask
        mask_value: The value to mask in the targets

    Returns:
        function: a loss function that acts like loss_function with masked inputs