Including observation weights

In SparseGPRegression, is it possible to include observation weights?

Basically, I have data that age over time, the most resent measures are the ones closest to the current state.

I was thinking that it might be possible to change X from being a list of floats to a list of tuples.

E.g

x = [0.1, 0.2, 0.3]
weights  = [1.0, 0.9, 0.8]

x_weighted = list(zip(x, weights))

But I’m sceptic that this would actually do what I want it to. I want the functions to put more focus on being accurate with the observations that has a high weight, and vice versa.

I think you can just create a new likelihood mimic Gaussian implementation for this. You can use pyro.poutine.scale to add the weight.

Would I replace this in Gaussian:
return pyro.sample(self._pyro_get_fullname("y"), y_dist, obs=y)

With:
return pyro.poutine.scale(pyro.sample(self._pyro_get_fullname("y"), y_dist, obs=y), scale = weights)

Sorry, my suggestion is wrong. We only use scale to put weights over batch dimensions. But in GP, obs dimensions are event dimensions (GPs are distributions over functions, rather than tensors). So making a wrapper for Normal or using scale does not make sense in this context. I think you can mask the likelihood and add your customized log likelihood here

y_dist = dist.Normal(f_loc, y_var.sqrt())
if y is not None:
    log_lik = y_dist.log_prob(y)
    log_lik_scaled = log_lik * weights  # or logsumexp?
    pyro.factor("weighted_likelihood", log_lik_scaled.sum())
return pyro.sample(self._pyro_get_fullname("y"), y_dist.to_event().mask(False), obs=y)