liveBook · Manning

Sentiment analysis

As explained in Grokking Machine Learning

The computational task of determining an expressed opinion or affective polarity in text.

Sentiment analysis determines whether text expresses a positive or negative opinion. As a classification task, it predicts a category rather than a number. section 5.0 section 6.4

A review classifier can be built by turning text into word features and training a model:

  • Represent each review as a dictionary of words and their counts. section 6.4
  • Train a logistic classifier with the word counts as features and sentiment as the target. section 6.4
  • Inspect the learned word weights to see which words contribute to the model. section 6.4

Classifying movie reviews

An IMDB dataset pairs review text with positive or negative labels. A review containing “comfortable” contributes a positive coefficient in the example model. section 6.4

How Grokking Machine Learning covers it

How deep it goes
Demonstrates word-count features, logistic-classifier training, and inspection of learned coefficients.
Examples
Uses labeled IMDB movie reviews and learned coefficients for words such as “comfortable.”
What you can do after
Apply it via Turi Create to turn review text into word-count features and train a logistic classifier.
How it connects
Links classification with logistic regression and word-count features.

Also explained in

Compare how 12 books explain sentiment analysis →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.