0

I am trying to train a model for sentiment analysis and below is my trained Multinomial Naive Bayes Classifier returning an accuracy of 84%.

I have been unable to figure out how to use the trained model to predict the sentiment of a sentence. For example, I now want to use the trained model to predict the sentiment of the phrase "I hate you".

I am new to this area and any help is highly appreciated.

1 Answers1

1

I don't know the dataset and what is semantic of individual dictionaries, but you are training your model on a dataset which has form as follows:

[[{"word":True, "word2": False}, 'neg'], [{"word":True, "word2": False}, 'pos']]

  • That means your input is in form of a dictionary, and output in form of 'neg' label. If you want to predict you need to input a dictionary in a form:

{"I": True, "Hate": False, "you": True}.

  • Then:

MNB_classifier.classify({"love": True})

>> 'neg'

or MNB_classifier.classify_many([{"love": True}])

>> ['neg']