Code error in pytorch official tutorial about tensorboard

I am new to pytorch, so I hope to get familiar with it quickly with official tutorials. When follow tutorial about tensorboard(url: https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html) , I find a possible code error in part 6. Assessing trained models with Tensorboard.
The code in add_pr_curve_tensorboard() uses writer.add_pr_curve() in a wrong way. According to the definition, the second parameters of writer.add_pr_curve() should be the ground truth data instead of prediction labels.
I think it may mislead others who are not familiar with the precision-recall curve. It would be great if we could correct this.
Anyway, thanks a lot for providing such good tutorials to beginners!

Could you please comment on this issue?

I am excited to see this post. I have found this problem, too. And I change the second parameter of
writer.add_pr_curve() from “test_preds == class_index” to “testset.targets == class_index”. And I got terrible percision-Recall curve(showed in the following picture). I just wonder if you have corrected the error in the tutorial and run the code you corrected. If you have, was the pr curve you got same as mine?
I am looking forward to your response! :grinning: :grinning:

I am sorry for the late reply. The issue on github provides a correct way same as me. It should be a exact code error in the tutorial. I will comment the issue on github right away.
As a new user, I’m not sure how to make this topic solved. It would be great if you can help me out. Thanks a lot!

1 Like