-
-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve GMARE metric computation formula #2087
Comments
This metric is similar to the Geometric Mean Absolute Error which works fine in ddp. I think the error is in the computation of the relative term. Line 147 of the test, @KickItLikeShika What do you think ? |
Interesting! thanks for the explanation @sdesrozis , but I'm wondering here, isn't that mismatch in the results confusing for the user? I don't exactly which way is the right one for computing this metric (computing the mean on each proc separately -like the metric itself-, or the way in the tests). So I don't know should I edit the way we compute the metric, or this test? |
The answer is in the GMARE definition 😊 The actual implementation sounds weird to me. The results should be different whether the number of procs used. I didn't look in details and I think you should do to fix this issue. I can help if needed. IMO the good implementation is the test one. |
Thanks @sdesrozis for clarifications! |
From the reference paper p14 :
So the key point is to understand well what means the mean of all actuals. It sounds to me that a mean over all On the other hand, it seems that GMRAE would be a metric for forecasting time series. Therefore, 𝐴̅ stands for A at the previous time... See https://www.rdocumentation.org/packages/rminer/versions/1.4.6/topics/mmetric or https://support.numxl.com/hc/en-us/articles/115001223403-GMRAE-Geometric-Mean-Relative-Absolute-Error I don't know whether this metric is relevant... HTH |
Thanks for @sdesrozis for providing help! @reinit__is_reduced
def reset(self) -> None:
self._num_examples = 0
self._sum_of_errors = torch.tensor(0.0, device=self._device)
def _update(self, output: Tuple[torch.Tensor, torch.Tensor]) -> None:
y_pred, y = output[0].detach(), output[1].detach()
errors = torch.log(torch.abs(y - y_pred) / torch.abs(y - y.mean()))
self._sum_of_errors += torch.sum(errors).to(self._device)
self._num_examples += y.shape[0]
@sync_all_reduce("_sum_of_errors", "_num_examples")
def compute(self) -> float:
if self._num_examples == 0:
raise NotComputableError(
"GeometricMeanRelativeAbsoluteError must have at least one example before it can be computed."
)
return torch.exp(self._sum_of_errors / self._num_examples).item() It worked well but not for the integration tests as we define batches (and that was the reason that the integration tests were different from other metrics), so we calculate the mean over a single batch, and that's the cause of the misleading results in case of (integration and distributed). |
@KickItLikeShika Thanks for exploring the usage of this metric. We don't have any time series use case. Why not provide such an example to illustrate the GMRAE usage, and others regression metrics as well ? Although I don't have any experience on this topic. |
I have been looking for examples or something shows the usage of the metric, but I found nothing solid yet, but this link you sent above somehow clarifies the usage of the metric https://support.numxl.com/hc/en-us/articles/115001223403-GMRAE-Geometric-Mean-Relative-Absolute-Error |
Yep I cited this article in my previous post. Nothing solid, I agree. |
Months ago I tried to improve GMARE to be compatible with DDP, but I had a very strange issue, and the distributed tests were failing, I thought I did something wrong (even I updated +10 metrics for DDP then) so I ignored it at that time, today I was trying to update it and send the PR but I had the same issue, the tests distributed tests are failing.
And here is the code and the tests
master...KickItLikeShika:improve-GMRAE-ddp
The text was updated successfully, but these errors were encountered: