Obtaining the posterior distribution of the input X that produce a certain output y0

Hello,

I am new to Edward and have a basic question that I cannot find an answer for: Is there a way in Edward to obtain the posterior distribution of X that produce a certain output y from y = f(X)?

I can easily predict y = f(X) after training [similar to the regression tutorial], but I want it the other way around. I want to fix y = y0 and obtain the posterior distributions of X that will produce y0. Please note that f() in my example is complex and an inverse of f() cannot be easily computed.

In OpenBUGS, I can easily do this by adding an observation to the end of the training data: the values for X in this observation will be NA (missing), but the value of the y will be observable (y0). By monitoring the X for this last observation, BUGS outputs the posterior distribution for X given y = y0. Is there a way to do this in Edward?

Thanks in advance for your help!

I am replying to my own post to help others who may have a similar question. The way, I did it was to define a second distribution that would share the same parameters as the first model, but I used X_new and y_new as the model inputs and outputs. In this second distribution X_new is latent and y_new is the target data that I have. I got the idea from a video by Andrew Gelman on using STAN. https://www.youtube.com/watch?v=T1gYvX5c2sM&t=1608s. The STAN manual was also useful. I am not sure if this is the best way of getting the posterior distributions on the model inputs given a new set of data, but it seems to be working well.