Model Evaluation
Sentiment Magnitude
In shortHow strong the emotion in a text is, regardless of whether it is positive or negative; returned by Google's Natural Language API with the sentiment score.
Sentiment magnitude is a measure of how much emotion a text contains, regardless of direction. It is returned by the Google Cloud Natural Language API alongside the sentiment score: the score says whether the text is positive or negative, and the magnitude says how strongly emotional it is overall.
How it works
- The score runs from -1.0 (negative) to +1.0 (positive).
- Magnitude runs from 0.0 upwards and is not normalised for the whole document: each emotional statement adds to it, so longer texts tend to have higher magnitudes.
- At sentence level, magnitude is normalised between 0 and 1.
- The API returns both for the document and for each sentence, and in v1 also per entity through entity sentiment analysis.
Reading the two together is the point. Google’s documentation gives examples: a clearly positive text might score 0.8 with magnitude 3.0, a clearly negative one -0.6 with magnitude 4.0, a neutral text 0.1 with magnitude 0.0, and a mixed text 0.0 with magnitude 4.0. A score near zero is ambiguous on its own; magnitude tells you whether the text is genuinely neutral or full of conflicting emotions.
How it’s used in SEO and marketing
- Review analysis: find mixed reviews (score near zero, high magnitude), which usually contain the most specific praise and complaints.
- SERP analysis: score ranking titles and descriptions; MLforSEO’s SERP automation guide uses score plus magnitude to spot mixed results worth reading.
- Brand monitoring: track how strongly people feel about your brand or products, not only in which direction.
- Visualisation: plot results with score on one axis and magnitude as bubble size, as shown in the Introduction to ML course.
Example
Two reviews both score 0.0. The first, “Arrived on Tuesday. Blue colour.”, has magnitude 0.1: it is genuinely neutral. The second, “Love the design, but the strap broke in a week and support ignored me”, has a high magnitude because strong positive and negative statements cancel out in the score. Filtering for that pattern surfaces the feedback your product team most needs.
Limitations and things to watch
- Compare magnitudes only between texts of similar length, or normalise by sentence count.
- Sarcasm, domain jargon and mixed languages reduce accuracy.
- v1 and v2 of the API score the same text differently, and v2 has no entity sentiment method; keep one version for tracking.
- Magnitude is not an emotion label; for specific emotions (joy, anger) use emotion scores from tools such as IBM Watson NLU.
Learn it on MLforSEO
- How to do Sentiment Analysis with Google’s Natural Language API in Google Sheets
- Sentiment Analysis: A Deep Dive Into the Theory, Methods, and Applications
- Semantic Analysis of Customer Reviews with Machine Learning
- Sentiment Analysis No-code Template with Google Cloud Natural Language API
- Introduction to Machine Learning for SEO (course)
Where Sentiment Magnitude shows up on MLforSEO
Learn it in a course
Read about it on the blog
Sentiment Analysis: A Deep Dive Into the Theory, Methods, and Applications
What Entity Extraction Is, and Where It Fits in SEO
How to do Sentiment Analysis with Google’s Natural Language API in Google Sheets (Apps Script)
How to do Entity Extraction with Google’s Natural Language API in Google Sheets (Apps Script)
Sources and further reading
Other terms from Model Evaluation
- Accuracy (ML metric)Accuracy is the share of all predictions a model gets right. It is the simplest evaluation metric, but it misl…
- Coherence ScoreA metric for how interpretable a topic model's topics are, based on how often each topic's top words appear to…
- Confusion MatrixA confusion matrix is a table comparing a classifier's predictions with the true labels, showing exactly which…
- Cosine SimilarityA measure of how closely two vectors point in the same direction, used to score how similar two texts, keyword…
- Emotion ScoresPer-emotion scores (joy, sadness, fear, disgust, anger) an emotion analysis API assigns to a text, each from 0…
- Entity Salience ScoreA 0 to 1 score from Google's Natural Language API showing how central each extracted entity is to the analysed…
- Euclidean DistanceEuclidean distance is the straight-line distance between two points in any number of dimensions, used to compa…
- F1 ScoreA single evaluation metric that balances precision and recall (their harmonic mean); useful when classes are i…
- Ground TruthGround truth is the set of correct answers, usually labelled by people, that a model is trained on or checked…