Skip to content

EpochMetric signature check caused error #1103

@sandylaker

Description

@sandylaker

🐛 Bug description

I tried to re-implement the ROC_AUC like the one in contrib.metrics.roc_auc, and passed some extra kwarg options to support for multiclass and multilabel classification. However, when I run my code, an Error "Number of classes in y_true not equal to the number of columns in 'y_score' " was raised by scikit-learn. I checked the y_true of the whole epoch, and the number of unique values was equal to the number of columns of y_score. Next, I checked the source code of EpochMetric, and found that in update function, it tried to execute the compute_fn at the first iteration. I supposed this was the cause: the y_true of a single batch might not contain all the classes of the dataset, therefore scikit-learn would throws the error mentioned above. The same problem occured for AveragePrecision.

Environment

  • PyTorch Version (e.g., 1.5): 1.5
  • Ignite Version (e.g., 0.3.0): 0.3.0
  • OS (e.g., Linux): Ubuntu 18.04
  • How you installed Ignite (conda, pip, source): pip
  • Python version: 3.7.6
  • Any other relevant information: None

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions