How is it possible for RNN to do sentiment analysis?
RNNs do not learn to predict sentiment. They learn correlations between the input data and the target labels. If they see that every time the input contains the word &quot;bad&quot; they have to generate the label &quot;negative&quot;, then they will learn it. If they see in the training data that the previous phenomenon happens always except when there is a &quot;not&quot; before &quot;bad&quot;, then they will learn it. Depending on how the data distribution is, they may generalize the negation to any combination of verbs and adjectives, or maybe not, and they only handle negation appropriately when the input data is very very similar to the training data.
Your question seems to aim at understanding the &quot;internal dynamics&quot; of the RNN when it is predicting sentiment. While there is some research in that direction, I think they can still be considered as &quot;black boxes&quot;, in that we do not actually understand the functions modeled by neural networks and therefore their outputs are not &quot;explainable&quot;