How to display model confidence for classes in fastai?


I am trying to display the model confidence for each class label for the MultiCategory learner. To achieve this, I am using the probs from the get_preds() method and then running the following code:

preds, probs = learn.get_preds()
confs = torch.mean(probs.sigmoid(), 0)
confs = {l:round(c.item(),4) for l,c in zip(dls.vocab, confs)}
confs = sorted(confs.items(), key=operator.itemgetter(1),reverse=True)

Is this the right approach and is there a better way?

Any comments will be much appreciated.

Thanks in advance,

Best Regards,