2

I am working on a text classification problem and when I attempt to train my model with the data vectorized using TF-IDF it returns this error.

It is my understanding that this error appears when some of the labels were never predicted by the model. The error does not appear when I use CountVectorizer.

Do you have any suggestions on how to deal with this error?

Thank you

I know that you can get around this issue by passing np.unique(y_pred) as an argument for the metric score but thay would come with its own problems.

bls
  • 351
  • 2
  • 12
  • 1
    Does this answer your question? [UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples](https://stackoverflow.com/questions/43162506/undefinedmetricwarning-f-score-is-ill-defined-and-being-set-to-0-0-in-labels-wi) – Mohammad hp Feb 09 '20 at 18:18
  • 1
    No it does not, the suggestion they are proposing in that post is to ignore the warning or filter only the existing labels which is problematic. It leads to a bias in the analysis of the data. I am expecting to know if there is another way to deal with the problem that does not involve 'sweeping it under the rug' – bls Feb 09 '20 at 19:23
  • Please can you post your code and paste the error? – Noki Feb 10 '20 at 08:22

0 Answers0