I am trying to use the mean average accuracy as the metric, instead of accuracy. And I find there is a metric name ‘Precision’ seems doing the work. But when I use
metric=Precision in create_cnn,
it has the following error,
AttributeError: ‘Precision’ object has no attribute ‘detach’
What else should I do if I wish to use Precision?
I also try to add a mean_acc below, but the value is always nan. Do not know the reason yet.
def mean_accuracy(input:Tensor, targs:Tensor)->Rank0Tensor:
“Compute mean accuracy with targs when input is bs * n_classes.”
preds = input.argmax(-1).view(-1).cpu()
targs = targs.cpu()
Thank you so much @AlisonDavey. It is much clearer now. By the way, there is another metric class named ‘KappaScore’ , which seem doing similar like ‘Precision’. What are the pros/cons of ‘KappaScore’ compared with Precision?