I'm dealing with text classification using BERT pre-trained model with a multiclass imbalanced dataset. When we use a 0.5 default classification threshold we obtain a f1 measure of around 0.7. But we have noticed that when we decrease the classification threshold we obtain a better performance.

If we use different binary classifiers, one for each class as positive, we have different imbalance rates. And we have notice that the optimal classification threshold decreases as the imbalance rate increases.

Is this an expected behavior? Besides that. Is it valid to change the classification threshold to the optimal value in order to increase the classifier performance?

Best regards.


1 Answer 1


Yes it is a very common thing to do, for controlling tradeoff of objectives.

One often encountered example is to precision-recall tradeoff where we move the threshold to strike a balance between desired precision and recall level.

As a note, this practice is for classification in general, regardless of neural network or not.

  • $\begingroup$ @Zaratruta and may I humbly advise you not to jump directly into complex models e.g. BERT, but grab the basics of machine learning first. Risk is you will quickly lose track of what you are doing. $\endgroup$
    – lpounng
    Commented Mar 9, 2023 at 2:56

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.