-
-
Notifications
You must be signed in to change notification settings - Fork 657
Description
❓ Questions/Help/Support
I've been using the Accuracy
class (in ignite.metrics
) successfully so far in a multi-class setting to compute test set accuracy.
Recently, I've hit a new scenario/dataset where the test set has different number of classes for each example. You can think of this as a multiple-choice selection task, where each example has a different number of candidates.
Now in this scenario, when I used Accuracy
, I got the below error:
ERROR:ignite.engine.engine.Engine:Current run is terminating due to exception: Input data number of classes has changed from 13 to 81.
I dived into the code and I see that the base class for Accuracy
, i.e., _BaseClassification
assumes that the number of classes/candidates is fixed across test set examples. And this is why I'm getting the above error at run-time.
However, for multi-class accuracy, as you can see in the update()
method here, we are simply computing the number of correct predictions via argmax
along dimension-1 and measuring matches against y
.
This computation of correct
should be accurate even if the number of candidates changes across two examples from the test set, right?
So in effect, the computed accuracy would be correct even in such a case because the underlying variables are computed correctly?
What do you think, @vfdev-5? Is it possible to have a version of Accuracy
for multi-class where there is no expectation that the number of classes is the same across all examples in the test set?