Beginner here!

I have a dataset, with reviews of a product as text, ratings for the product.

My previous motive was to use Naive Bayes classifier for sentiment analysis. But my data doesn't have the variables( sentiment) required - negative/positive.

  1. Shall I use the ratings (1-5) and encode it as positive and negative?
  2. Or using the lexicon-based methods is more valid?

1 Answer 1


That would depend on the exact goal of the task and the specifics of the dataset, but in general I would say that it's always better to use the information specifically provided with the data if it's relevant for the task. In this case the rating for the product is indeed very likely to reflect the sentiment of the text, so I would go with it. Notice that you could also do both and compare the cases where the predicted sentiment differs from the one derived from the rating.

Given that the ratings are provided as 1-5 scores I would also consider the option of treating the task as a regression problem, instead of the standard binary classification setting.

  • $\begingroup$ Thanks for the answer. Btw won't there be cases like when a user has rated the product 4 but has still written a tad of disappointing thing about the product? $\endgroup$
    – Maxima
    Jan 20, 2020 at 4:02
  • $\begingroup$ @Swarley I was assuming that you're interested in the sentiment of the full review, is that correct? If yes I think it's fine to consider a mostly positive review as positive. Also as I mentioned you could use the rating as a more fine-grained level of sentiment by using regression, i.e. your system would predict a numerical value between 1 and 5 instead of just a class positive/negative. $\endgroup$
    – Erwan
    Jan 20, 2020 at 14:44

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.