sdv-dev/DeepEcho

`PAR` model handling sample states with missing values

sarahmish opened this issue · 0 comments

Environment details

If you are already running DeepEcho, please indicate the following details about the environment in
which you are running it:

  • DeepEcho version: 0.2.0
  • Python version: 3.7

Question

In PAR model _sample_state

dist = torch.distributions.Bernoulli(torch.sigmoid(x[0, 0, missing_idx]))
x[0, 0, missing_idx] = dist.sample()
x[0, 0, mu_idx] = x[0, 0, mu_idx] * (1.0 - x[0, 0, missing_idx])

Sampling from the Bernoulli distribution can yield a possibility of predicting the value as missing, which we then adjust mu to become zero to handle. This will have an effect on the returned data in _tensor_to_data
if (x[i, 0, missing_idx] > 0) and props['nulls']:
data[key].append(None)
else:
data[key].append(x[i, 0, mu_idx].item() * props['std'] + props['mu'])

This would potentially make us return props['mu'] value for each state we sampled as missing.

We should probably remove L472 and keep mu as is, then _tensor_to_data will handle the case as needed.

The same would be true to the "count" data type as well.