Fix erroneous loss for ExactGP multitask models
The code in ExactMLL divides by `targets.size(-1)`.
For multitask models, this is the number of outputs.
Instead, this code divides by `function_dist.event_shape.numel()`,
which will result in losses that are similar in size to univariate
ExactGP models.
[Fixes
[Fixes
[Fixes
[Addresses
[Addresses
@@ -63,7 +63,7 @@ class ExactMarginalLogLikelihood(MarginalLogLikelihood):
res = self._add_other_terms(res, params)
# Scale by the amount of data we have
- num_data = target.size(-1)
+ num_data = function_dist.event_shape.numel()
return res.div_(num_data)
def pyro_factor(self, output, target, *params):
