I'm working with PyMC3 and unsure about how to mark certain variables as "observed". In a simple example, I could have two input variables modeled as a uniform distribution on [0, 1]. I know a third "output" random variable is equal to the product of the two inputs, and let's say that I observed that the first input is 1 and the output is 0. Then I want to use PyMC3 to predict the second input, which in this case must be 0.
It is unclear for me how to tell PyMC3 that the output is observed since it is the result of a mathematical expression and not created explicitly from a constructor.
import pymc3 as pm
with pm.Model() as model:
input1 = pm.Uniform('RV1', lower=0, upper=1, observed=1) # API is clear how to mark it observed
input2 = pm.Uniform('RV2', lower=0, upper=1) # This one is not observed
output = input1 * input2 # How to tell PyMC3 the observed value of "output"?
# Now I will do variational inference, sampling, etc... on the model
The random variables are technically boolean random variables but I need to model them as continuous in order to do variational inference. And I have a lot of them, this is a minimum example. Setting output.observed = 0
doesn't seem to work, although it doesn't crash.