I have time-series data and want to build a 1D CNN / LSTM and want to use a Keras Masking Layer to 'ignore' missing values.
My data is structured as follows: I have 1000 patients, for which 3 variables (heart rate, oxygen concentration, breathing frequency) are measured for 20,000 minutes, one measurement per variable per minute.
In this dataset, I often have patients that have missing values for one of the 3 variables while the others have sound values.
For example, the measurements per minute for a given patient can look like this:
patient_1_heart = [70, 71, 68, 80, ...]
patient_1_oxygen = [90, 89, NA, 91, ...]
patient_1_breathing = [20, 21, 20, 19, ...]
Now my question is, can I mask the NA value in patient_1_oxygen, or can I only mask a whole timestep? Since there are measurements for the other 2 variables at that same timestamp.
Given that the Keras documentation states the following:
"For each timestep in the input tensor (dimension #1 in the tensor), if all values in the input tensor at that timestep are equal to mask_value, then the timestep will be masked (skipped) in all downstream layers (as long as they support masking)." https://keras.io/api/layers/core_layers/masking/
The way this is phrased, it seems that all values for a given timestamp should be equal to the mask value in order for masking to occur? And if that is the case, how do I go about masking/ignoring a single cell, as in the example above, given that imputation is not an option?