I have a time series of features $x_1,x_2,x_3,...,x_n$. I want to make a prediction $y_1,y_2,y_3,...,y_n$ for each timestep. However, in my training data some of the $y$ can be nan. I'd like the fit to just ignore these (i.e. the cost for this pair measured $y$ and predicted $y$ is zero). I'm currently using tensorflow through Keras.
Is there an analogue of the masking layer for the label? I'm currently using tensorflow through Keras. Alternatively, it might be possible to change the loss function, but I don't know how, expecially while retaining numerical efficiency.