Classify a sentiment baseline
Here is a whole text classifier in a few lines. Give every word a score: positive for words like great, negative for words like bad. To judge a text, add up the scores of its words. Above 0 the text is positive, below 0 negative. It is fast and you can see exactly why it gave its answer. It is also easy to fool, and knowing how is the point of this lesson.
About this lesson
Words to know
- baseline
- A simple model that sets the score a more complex model has to beat.
- bias
- A number added after the weighted sum. It lets the result be something other than 0 when every input is 0.
- bag of words
- A text described only by how often each word appears. Word order is ignored.
Why it matters
Every stronger model should be compared with a simple baseline like this on the same data. If the big model is not clearly better, it is not worth its cost.
With a year
How it works, a worked example, the exercise with its tests, three hints and the explained solution are in the app, with a year of Algo150 for $19. The first chapter, Math foundations, is free for everyone: start with Follow a gradient.