Multiclass evaluation not working
See original GitHub issueHello,
I am new to Transformers library and I’m trying to do Sequence Classification. I have 24 labels and I am getting the following error:
ValueError: Target is multiclass but average=‘binary’. Please choose another average setting, one of [None, ‘micro’, ‘macro’, ‘weighted’].
Even though I already added the averaging method as such:
metric = load_metric('precision', average='weighted')
Would someone kindly point me towards whatever I’m doing wrong? I’m able to fine-tune the pre-trained BERT model if I use ‘accuracy’ as the metric. But somehow it’s not accepting my average='weighted'
argument.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Evaluating multiclass imbalanced problem per class
For a multiclass imbalanced problem, accuracy is not a good metric to evaluate model performance. Equally, accuracy is a global metric, ...
Read more >Comprehensive Guide on Multiclass Classification Metrics
Using these metrics, you can evaluate the performance of any classifier and compare them to each other. Here is a final cheat-sheet to...
Read more >Evaluation measures for multiclass problems - Gabriele Lanaro
Evaluation measures for multiclass problems · Confusion matrix · Precision · Recall · F1-score · Micro and macro averages · Accuracy · Cross...
Read more >Evaluating Multi-Class Classifiers | by Harsha Goonewardana
Best practice methodology for model selection for a multi-class classification problem is to use a basket of metrics. Then the appropriate ...
Read more >Performance Measures for Multi-Class Problems
How to calculate performance for multi-class problems? ... For evaluate a scoring classifier at multiple cutoffs, these quantities can be ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi there!
You are passing the
average
argument when you load the metric, instead, you should pass it to thecompute
method like this:Hope this helps!
No problem. Sorry, I wasn’t sure if this was a bug or my own mistake so I didn’t use the bug template. Here you go:
Environment info
transformers
version: 4.17.0Who can help
Information
Model I am using (Bert, XLNet …): bert-based-cased
The problem arises when using:
The tasks I am working on is:
To reproduce
Steps to reproduce the behavior:
Dataset.from_pandas(my_data)
AutoTokenizer.from_pretrained('bert-base-cased')
and I got this error:
Expected behavior
I expect the model to complete training without an error. I am able to do this if I used
metric = load_metric('accuracy')
but not with precision, recall, or f1.