Samarth
Samarth

Reputation: 252

How are the Google Cloud Natural Language API Sentiment Analysis outputs interpreted?

I am trying to get a better understanding of the outputs given by Google's sentiment analysis API. It takes in a sentence and gives out two values - magnitude and score. I am trying to interpret the magnitude value better. Magnitude is defined in the documentation as -

A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).

Initially, I thought it is a confidence score or weight but I am not sure how the value would change since it can be ANY number. Does anybody know how it is calculated or what it means apart from the definition provided in the documentation?

Upvotes: 1

Views: 1120

Answers (1)

Ksign
Ksign

Reputation: 817

magnitude indicates the overall strength of emotion (both positive and negative) within the given text, between 0.0 and +inf. Unlike score, magnitude is not normalized; each expression of emotion within the text (both positive and negative) contributes to the text's magnitude (so longer text blocks may have greater magnitudes) (Ref).

The score of a document's sentiment indicates the overall emotion of a document. The magnitude of a document's sentiment indicates how much emotional content is present within the document, and this value is often proportional to the length of the document (Ref).

A document with a neutral score (around 0.0) may indicate a low-emotion document, or may indicate mixed emotions, with both high positive and negative values which cancel each out. Generally, you can use magnitude values to disambiguate these cases, as truly neutral documents will have a low magnitude value, while mixed documents will have higher magnitude values (Ref).

Upvotes: 1

Related Questions