pymc-devs / pymc2

THIS IS THE **OLD** PYMC PROJECT (VERSION 2). PLEASE USE PYMC INSTEAD:
http://pymc-devs.github.com/pymc/
Other
879 stars 229 forks source link

Inference with Theano shared variable having missing data #181

Closed FlorianWilhelm closed 6 years ago

FlorianWilhelm commented 6 years ago

According to the documentation, pymc3 creates automatically random variables which model missing values if numpy arrays containing NaNs or a masked arrays are provided as observations. This works fine for me. Also according to the documentation if I want to sample from my posterior in order to get predictions, Theano shared variables should be used already during the inference. Now passing a Theano shared variable (constructed with a numpy array having missing values) as observations does not automatically create a _missing random variable as before. It would be nice to mention that in the documentation and to give an example as well as helper functions to manually construct these random variables to encode masked values.

fonnesbeck commented 6 years ago

You've made a common error, which is to post a PyMC3 question in the PyMC issue tracker. Actually, since this is not a bug report per se, the best place to post it is in our Discourse forum. I will close this, but also address your question:

You don't need to use shared variables for predictions, necessarily. You can use sample_ppc (or sample_posterior_predictive if you are running the master branch). You can also create prediction nodes in your model, if you prefer.

FlorianWilhelm commented 6 years ago

@fonnesbeck Thanks for your help. I was just following the Predicting on hold-out data section but I'll check out the forum now. Thanks again.