titusss / Sentiment-Analysis-with-Gcloud

Automatically download and analyze the sentiment of YouTube subtitles with Gcloud's NLP API.
1 stars 0 forks source link

Score, Magnitude, and Overall Sentiment are the same #1

Open MichaelKuz opened 3 years ago

MichaelKuz commented 3 years ago

Thanks for this nice repository.

I'm working on a similar project, and am interested in making a version of the infographic charts you have at the bottom of the readme. However, in my testing I've found that sentiment score, magnitude, and overall sentiment are the same (with the exception of magnitude being the abs() of score). This happens both in your code and in mine.

That makes the graphs confusing, since they seem to be graphing magnitudes that are different from sentiment scores.

An added complication is that in almost all of the examples and docs I can find online, magnitude and score are the same.

If you have a moment, I'd be curious to hear if you ever actually saw a magnitude that was different from the score, if you think something has changed in the API from when you last used it, or if I'm misunderstanding how these scores work.

Screen Shot 2021-03-18 at 4 03 09 PM
MichaelKuz commented 3 years ago

In reviewing the charts more closely, it appears that Red is simply ABS(Blue), and that Yellow = Blue.

This is consistent with the data I'm seeing above, although it makes for a chart that is less insightful than it appears to be at first glance.

It seems that the Google NLP API always returns magnitude = abs(score) on the sentence level, and that magnitude is only useful at the document level – where it is a sum of all of the sentence magnitudes returned in that response.

titusss commented 3 years ago

Hi Michael,

Yes with Google's NLP API the composite sentiment value is what matters. I included magnitude and score to give additional dimensions, even though they're similar minus polarity (+-). There should be APIs out there that output a larger variety of sentiment scores. Feel free to share if you find some. I'll look into it as well.