Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is a bug in final_classifier.py #32

Open
Bingyang0410 opened this issue Feb 27, 2023 · 0 comments
Open

There is a bug in final_classifier.py #32

Bingyang0410 opened this issue Feb 27, 2023 · 0 comments

Comments

@Bingyang0410
Copy link

Bingyang0410 commented Feb 27, 2023

In this line 291:
per_class_accuracies[i] = torch.div((predicted_label[is_class]==test_label[is_class]).sum().float(),is_class.sum().float())

if the output have some NaN value, the output of the accuracy maybe Nan

Thus, I think the code need to change as follows:

if torch.any(torch.isnan(per_class_accuracies[i])):

      per_class_accuracies[i] =  torch.where(torch.isnan(per_class_accuracies[i]),torch.full_like(per_class_accuracies[i],0),per_class_accuracies[i])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant