Given the following model from the famous oil wildcatter problem can someone show me how to do exact inference and calculate P(oil|seismic=0) ?
def oil_wildcatter_model():
# Prior probability of oil being present (3 categories: 0, 1, 2)
oil_probs = torch.tensor([0.5, 0.3, 0.2])
oil_present = pyro.sample("oil_present", dist.Categorical(oil_probs))
# Likelihood of seismic results given oil presence (3x3 matrix)
seismic_given_oil = torch.tensor([
[0.6, 0.3, 0.1], # P(seismic | oil == 0)
[0.3, 0.4, 0.3], # P(seismic | oil == 1)
[0.1, 0.3, 0.6] # P(seismic | oil == 2)
])
# Conditional seismic observation
seismic_probs = seismic_given_oil[oil_present]
seismic = pyro.sample("seismic", dist.Categorical(seismic_probs))
return oil_present, seismic