torchmetrics
torchmetrics copied to clipboard
add optional ignore_index in all metrics
🚀 Feature
Could you please consider incorporating a systematically optional ignore_index argument in all metrics?
For instance, in classification tasks, we currently have the ability to use ignore_index as follows:
torchmetrics.classification.MulticlassJaccardIndex(num_classes=15, ignore_index=255)
However, in the case of regression, there is currently no mechanism to utilize ignore_index when computing metrics such as MSE or MAE.
Motivation
There is a plethora of datasets for regression tasks (but not limited to regression) that contain pixel values representing missing data. It is crucial to have the capability to ignore these values when computing metric statistics.
Pitch
I suggest that all metrics be updated to implement an optional ignore_index argument.
Alternatives
Is it feasible to incorporate the ignore_index functionality in advanced metric settings? For example, as shown in https://lightning.ai/docs/torchmetrics/stable/pages/overview.html#metric-kwargs
Additional context
For instance, in the context of depth maps, ground truth data may contain missing values replaced with an arbitrary ignore_index, and the training loss is already designed to ignore them. This feature would provide consistency and flexibility across various metrics.
Hi! thanks for your contribution!, great first issue!