You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that CalibrationError currently does not support some of the input data types mentioned in this table from the docs. In particular, it seems to break when fed with
preds=logits where logits is a (N, C) float32 tensor with potentially negative values.
preds=predictions where predictions is a (N,) int tensor with the predicted labels.
It still works with softmax-ed logits (preds=logits.softmax(-1)) or, generally, with and (N,)-dimensional float32 tensors (i.e. the binary input in the input data table mentioned above).
To reproduce:
N, C=10, 3targets=torch.randint(C, (N,))
# (N, C) non-negative: workspreds=torch.rand((N, C)) # non-negativeCalibrationError()(preds=preds, target=targets)
# (N, C) potentially negative: failspreds=torch.randn((N, C)) # potetially negativeCalibrationError()(preds=preds, target=targets)
# (N,) int type: failsCalibrationError()(preds=targets, target=targets)
# (N,) float type non-negative: workspreds=torch.rand((N,)) # binary non-negativeCalibrationError()(preds=preds, target=targets)
# (N,) float type potentially negative: failspreds=torch.randn((N,)) # binary potentially negativeCalibrationError()(preds=preds, target=targets)
Torchmetrics: v0.8
Pytorch: v1.11
The text was updated successfully, but these errors were encountered:
Hi @pietrolesci,
I have now created PR #985 to fix the issue. One note is that the metric cannot the case where preds is an int tensor since the metric needs access to the raw probabilities/logits of the model.
Hi there,
It appears that
CalibrationError
currently does not support some of the input data types mentioned in this table from the docs. In particular, it seems to break when fed withpreds=logits
wherelogits
is a(N, C)
float32 tensor with potentially negative values.preds=predictions
wherepredictions
is a(N,)
int tensor with the predicted labels.It still works with softmax-ed logits (
preds=logits.softmax(-1)
) or, generally, with and(N,)
-dimensional float32 tensors (i.e. the binary input in the input data table mentioned above).To reproduce:
Torchmetrics: v0.8
Pytorch: v1.11
The text was updated successfully, but these errors were encountered: