Skip to content

TypeError: accuracy() missing 1 required positional argument: 'task' #591

Answered by Surya-Abhinai
andysingal asked this question in Q&A
Discussion options

You must be logged in to vote

The function accuracy requires an additional positional argument called task. In your code, you have written training_accuracy = accuracy(preds, targets). This is missing the task argument, so the function will not work correctly.

The correct code should be training_accuracy = accuracy(preds, targets, task="multiclass").

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@KansaiUser
Comment options

@LuluW8071
Comment options

Answer selected by mrdbourke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants