0
votes

I have trained a fast text supervised model. I did used a pyfasttext python library to predict the model. Ex: I have data like this.

text - label

The meeting is planned - event
The work should be finished - task

Here, the model predict the label correctly. when planned or the work words occurs in the sentence. But I have list sentences which are non-related to the trained data. For ex: The dog is an animal

res = model.predict_proba_single('the dog is an animal\n')

output:

[(u'event', 0.49999999904767284)]

The output probability should be 0 or no label. Because the sentence is non relevant to all labels. The labels are multi-class. I gave example of two only.

Same thing also occurs in the scikit SGD classifier too.

How do I prevent this wrong prediction?

1
I think you just need more meaningful training data - user8408080
Yes. I should. But, at realtime we may not know what will come into our prediction data set..! - Giri Annamalai M

1 Answers

1
votes

You can ignore prediction outputs less than a threshold 0.5 for example (50%) , by doing that you can just extract relevant prediction or printing 0 or no label for other irrelevant cases , hope that helps