Suggestion on Page411 #123
baifanhorst
started this conversation in
General
Replies: 2 comments
-
Good call, I should add a version check in the notebook to include the task and number of classes if a user is using a newer version of torchmetrics than specified in the book. Thanks for mentioning. I also briefly saw the headlines of your other issues and will go through them one by one when time permits! Many thanks for submitting these! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you so much for your reply! I am just a beginner and a slow learner.
I am following your book line by line to study machine learning.
…On Mon, May 8, 2023 at 10:48 AM Sebastian Raschka ***@***.***> wrote:
Good call, I should add a version check in the notebook to include the
task and number of classes if a user is using a newer version of
torchmetrics than specified in the book. Thanks for mentioning.
I also briefly saw the headlines of your other issues and will go through
them one by one when time permits! Many thanks for submitting these!
—
Reply to this email directly, view it on GitHub
<#123 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3PUIM7R3PT7BIPN3KBB2NDXFEBTXANCNFSM6AAAAAAXZKTPRM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
--
Sincerely,
Fan.
Fan Bai
Florida State University, USA
Department of Mathematics
***@***.***
***@***.***
***@***.***
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
On page 411, several accuracies are added as class members in the MultiLayerPerceptron. However, when I tried to create an instance of this class, there occurred an error:
new() missing 1 required positional argument: 'task'
One possible solution is to specify several arguments for the accuracy function, as:
self.accuracy_train = torchmetrics.Accuracy(task="multiclass", num_classes=10)
self.accuracy_valid = torchmetrics.Accuracy(task="multiclass", num_classes=10)
self.accuracy_test = torchmetrics.Accuracy(task="multiclass", num_classes=10)
Namely, we should supply two arguments: task and num_classes. Also note that the names in these codes are slightly different from those in the book, so just change 'torchmetrics.Accuracy()' to 'torchmetrics.Accuracy(task="multiclass", num_classes=10)'.
Beta Was this translation helpful? Give feedback.
All reactions