# Bayesian inference based on data with uncertainty

Hi All,

I have a question on Bayesian inference with uncertain data. I browsed the tutorial on Bayesian linear regression, and noticed the data used in the tutorial are fixed value, so a MSE loss function can be conveniently used in the inference.

In my case, I also try to perfom Bayesian to get the posterior distribution of my model parameters (the model it self is quite complicated but I assume it would not matter too much in pyro). The difference is that the data I have are from experiments and are uncertain, e.g. ~ N(1.0, 0.1).

I wonder in this case, can I use pyro to perform the Bayesian inference for my model parameter? How can I define a loss function? Any example I can learn from?

Any suggestions would be appreciated! Thank you!

See https://pyro.ai/examples/bayesian_regression_ii.html If you know your measurement uncertainty `sigma = 0.1` then you can omit the prior over sigma as in the tutorial:

``````  def model(is_cont_africa, ruggedness, log_gdp):
a = pyro.sample("a", dist.Normal(0., 10.))
b_a = pyro.sample("bA", dist.Normal(0., 1.))
b_r = pyro.sample("bR", dist.Normal(0., 1.))
b_ar = pyro.sample("bAR", dist.Normal(0., 1.))
-     sigma = pyro.sample("sigma", dist.Uniform(0., 10.))
+     sigma = 0.1
mean = a + b_a * is_cont_africa + b_r * ruggedness + b_ar * is_cont_africa * ruggedness
with pyro.plate("data", len(ruggedness)):
pyro.sample("obs", dist.Normal(mean, sigma), obs=log_gdp)
``````