Answers.Body: <blockquote>
  <p>Why is it better to treat the rating prediction of a text review as a regression problem rather than a classification one? Is it because the ratings (1,2,3,4,5) are ordinal variables?</p>
  </blockquote>
  <p>Well, the main reason other than what you've referred to is that for rating, we can have scores like <code>4.7</code> that cannot be described with classification easily.</p>
  <blockquote>
  <p>What kind of Naive Bayes algorithm is the most suitable for this problem? Is Multinomial Naive Bayes the best one? It is a classifier, so I am unsure if it can deal with the ordinal nature of the rating variable or not.</p>
  </blockquote>
  <p>If I've understood you, you mean how to specify the order of the Markov chain. You have to note that Naive Bayes considers all words are independent. This is a very simple approach but can have good results in some situations. You can have a Markov chain of order 2 which means each of two consecutive words is dependent. You can have a Markov chain of higher orders, but you have to consider that the probability table will be sparse for higher orders, and you will not have a perfect result. Attention-based models can be used, and they have shown promising outcomes.</p>
  <blockquote>
  <p>The conditional independence assumption does not hold for text data. Terms are conditionally dependent on each other. Which observations in the dataset will be primarily affected by this assumption? Those observations whose word/feature counts are the least (the most sparse ones)?</p>
  </blockquote>
  <p>To be frank, I really do not know which will be affected. If you employ naive Bayes, this problem holds for all words. By the way, rare words are always important in tasks like information retrieval.</p>
  <blockquote>
  <p>If we want to keep a single feature/word in our model, which one should we choose? Should we keep the feature with the maximum sum of its word counts?</p>
  </blockquote>
  <p>I don't fully understand this, but it is dangerous in the sense that the word <code>the</code> usually has the most frequency, but it does not convey any special meaning.</p>
  <blockquote>
  <p>Generally, is it accurate to say that neural networks are better than KNN models for predicting the ratings because the text datasets are usually sparse? Does the performance of these two regressors mainly differs for observations whose word/feature counts are the least (the most sparse ones)?</p>
  </blockquote>
  <p>I can't say that. By the way, we have approaches like transfer learning for deep learning. KNN can have good results, but you have to obtain good features. On the other hand, the test phase can be time-consuming based on the frequency of your dataset. You have to note that word count is not the only statistics that can be obtained from a text. There are so many papers that consider for instance mutual info. By the way, you can use transformers with transfer learning that has shown astonishing performance.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-24T06:00:15.030Z
Answers.Text: Thanks. The higher the TF-IDF score, the more important or relevant the term. I know how to compute TF_IDF in python. Is it true to calculate the sum of all columns/features individually and then select the maximum of those sums as the first best feature?
Answers.UserDisplayName: ebrahimi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-24T06:46:35.453Z
Answers.Text: @ebrahimi about summing, I don't think it's a good idea due to the fact that you are not allowed to sum the age and height which are different features. At least, this is my opinion.  About relevance, I do agree, but about the importance, I'm not sure we can use it for classification. For classification, the interaction between words is profoundly important.
Answers.UserDisplayName: Green Falcon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-21T06:13:37.373Z
Answers.LastActivityDate: 2022-10-23T16:16:15.810Z
Answers.LastEditDate: 2022-10-23T16:16:15.810Z
Answers.UserDisplayName: Green Falcon
Body: <ol>
  <li><p>Why is it better to treat the rating prediction of a text review as a regression problem rather than a classification one? Is it because the ratings (1,2,3,4,5) are ordinal variables?</p>
  </li>
  <li><p>What kind of Naive Bayes algorithm is the most suitable for this problem? Is Multinomial Naive Bayes the best one? It is a classifier, so I am unsure if it can deal with the ordinal nature of the rating variable or not.</p>
  </li>
  <li><p>The conditional independence assumption does not hold for text data. Terms are conditionally dependent on each other. Which observations in the dataset will be primarily affected by this assumption? Those observations whose word/feature counts are the least (the most sparse ones)?</p>
  </li>
  <li><p>If we want to keep a single feature/word in our model, which one should we choose? Should we keep the feature with the maximum sum of its word counts?</p>
  </li>
  <li><p>Generally, is it accurate to say that neural networks are better than KNN models for predicting the ratings because the text datasets are usually sparse? Does the performance of these two regressors mainly differs for observations whose word/feature counts are the least (the most sparse ones)?</p>
  </li>
  </ol>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-10-23T18:04:22.460Z
Comments.Text: I could be wrong, but you should ask a single question per question, not 5.
Comments.UserDisplayName: David Hoelzer
Tags: <neural-networks><machine-learning><natural-language-processing><text-classification><naive-bayes>
Title: How to predict the rating of a text review and improve it?
UserDisplayName: ebrahimi
ThreadText: # How to predict the rating of a text review and improve it?
  
  (Asked by: username_0 on 2022-10-19)
  
  1. Why is it better to treat the rating prediction of a text review as a regression problem rather than a classification one? Is it because the ratings (1,2,3,4,5) are ordinal variables?
  2. What kind of Naive Bayes algorithm is the most suitable for this problem? Is Multinomial Naive Bayes the best one? It is a classifier, so I am unsure if it can deal with the ordinal nature of the rating variable or not.
  3. The conditional independence assumption does not hold for text data. Terms are conditionally dependent on each other. Which observations in the dataset will be primarily affected by this assumption? Those observations whose word/feature counts are the least (the most sparse ones)?
  4. If we want to keep a single feature/word in our model, which one should we choose? Should we keep the feature with the maximum sum of its word counts?
  5. Generally, is it accurate to say that neural networks are better than KNN models for predicting the ratings because the text datasets are usually sparse? Does the performance of these two regressors mainly differs for observations whose word/feature counts are the least (the most sparse ones)?
  
  **Tags:** neural-networks, machine-learning, natural-language-processing, text-classification, naive-bayes
  
  > **Comments:**
  > **username_1**: I could be wrong, but you should ask a single question per question, not 5.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-10-21. Score: 2 | Accepted answer
  
  > Why is it better to treat the rating prediction of a text review as a regression problem rather than a classification one? Is it because the ratings (1,2,3,4,5) are ordinal variables?
  
  Well, the main reason other than what you've referred to is that for rating, we can have scores like `4.7` that cannot be described with classification easily.
  
  > What kind of Naive Bayes algorithm is the most suitable for this problem? Is Multinomial Naive Bayes the best one? It is a classifier, so I am unsure if it can deal with the ordinal nature of the rating variable or not.
  
  If I've understood you, you mean how to specify the order of the Markov chain. You have to note that Naive Bayes considers all words are independent. This is a very simple approach but can have good results in some situations. You can have a Markov chain of order 2 which means each of two consecutive words is dependent. You can have a Markov chain of higher orders, but you have to consider that the probability table will be sparse for higher orders, and you will not have a perfect result. Attention-based models can be used, and they have shown promising outcomes.
  
  > The conditional independence assumption does not hold for text data. Terms are conditionally dependent on each other. Which observations in the dataset will be primarily affected by this assumption? Those observations whose word/feature counts are the least (the most sparse ones)?
  
  To be frank, I really do not know which will be affected. If you employ naive Bayes, this problem holds for all words. By the way, rare words are always important in tasks like information retrieval.
  
  > If we want to keep a single feature/word in our model, which one should we choose? Should we keep the feature with the maximum sum of its word counts?
  
  I don't fully understand this, but it is dangerous in the sense that the word `the` usually has the most frequency, but it does not convey any special meaning.
  
  > Generally, is it accurate to say that neural networks are better than KNN models for predicting the ratings because the text datasets are usually sparse? Does the performance of these two regressors mainly differs for observations whose word/feature counts are the least (the most sparse ones)?
  
  I can't say that. By the way, we have approaches like transfer learning for deep learning. KNN can have good results, but you have to obtain good features. On the other hand, the test phase can be time-consuming based on the frequency of your dataset. You have to note that word count is not the only statistics that can be obtained from a text. There are so many papers that consider for instance mutual info. By the way, you can use transformers with transfer learning that has shown astonishing performance.
  
  > **Comments:**
  > **username_0**: Thanks. The higher the TF-IDF score, the more important or relevant the term. I know how to compute TF_IDF in python. Is it true to calculate the sum of all columns/features individually and then select the maximum of those sums as the first best feature?  
  > **username_2**: @username_0 about summing, I don't think it's a good idea due to the fact that you are not allowed to sum the age and height which are different features. At least, this is my opinion.  About relevance, I do agree, but about the importance, I'm not sure we can use it for classification. For classification, the interaction between words is profoundly important.  
  
  ---
  
  