Can't seem to `sample_prior_predictive` on model with missing value imputation

Hi all,

I want to impute some missing values in the predictor features of a linear model, so followed @junpenglao’s excellent pymcon 2020 tutorial, prior 2017 blogpost, and referenced a couple of questions from other folks here (@Dominik 1), and (@nico 2) that seem relevant.

I bumped into an issue with sample_prior_predictive: either I’m doing something wrong, or it has a shape issue when there’s missing data in the observations.

I’ve created my own MRE here which describes my question and issue fully: MRE_missing_values · GitHub

Is this expected, or should I expect it to work? Have I done something wrong? Can I do something to fix it? I really need want prior predictive checks in my model workflow, so am grateful of any pointers.

EDIT:

Aha, after going for a walk I realised it’s probably because the auto-generated NoDistribution doesn’t have a random function pymc3/distribution.py at 2dee9dafb3541043ae23b66fe9262e70fbd2769a · pymc-devs/pymc3 · GitHub. I’ll take a read through the process that instantiates the dist. Would it be reasonable in principle for me to PR and add a random func that returns something (the mean?) of the parent dist, or is random missing for a good reason?

EDITEDIT

I gave it some thought and raised an issue with a proposed solution that I’ve manually hacked locally and it seems to work: see Give NoDistribution a random method so that `sample_prior_predictive` can work · Issue #4598 · pymc-devs/pymc3 · GitHub

Cheers!

1 Like