0
$\begingroup$

I trained multiclass text classififer with fasttext. I have a very low metric on one of the classes. Here are results of metrics for each class on test data:

               precision    recall  f1-score   support

     class1         0.66      0.68      0.67      1331
     class2         0.72      0.76      0.74      2297
     class3         0.50      0.32      0.39       410
     class4         0.62      0.60      0.61      1019

     accuracy                           0.67      5057
    macro avg       0.62      0.59      0.60      5057
 weighted avg       0.66      0.67      0.67      5057

as you see it doesnt work good on class 'class3'.

Data was unbalanced with class3 being the smallest. I cleaned text data before training. Butt still i get bad results. What can I do to improve it?

$\endgroup$

1 Answer 1

1
$\begingroup$

You could try several things. First, you might want to bootstrap these metrics and get a feel for how your model does on different subsamples of your data to determine if this is actually a problem or if this is just the model's performance on this class across different samples of your data (See here, here, and finally, here.

The next thing you might consider is creating class weights to perform cost-sensitive learning (see here). Basically, this tells the model to place a specific weight on classifying this class incorrectly.

Other suggestions would be to upsample or downsample your minority class. However, this should be done with caution. If the probability of your minority class in production truly is a minority class, this can distort the predicted probabilities, leading to poor classifier performance in production. You should check out this great post. This is probably the best post I have seen on this topic. Read the complete thread.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.