4 Using lines to split our points: The perceptron algorithm
This chapter covers
- What is classification?
- Sentiment analysis: How to tell if a sentence is happy or sad using machine learning.
- What are perceptrons, or discrete logistic classifiers.
- What is the perceptron algorithm?
- How to draw a line that separates points of two different colors.
- How to measure the error of a line that separates points of two different colors.
- How to code the perceptron algorithm in Python.
Here is the problem we’ll tackle in this chapter. How do we teach a computer to determine if a sentence is happy or sad? The way we tackle this is by introducing a branch of machine learning called classification. Much like regression, classification consists of predicting labels according to the features of our data. However, in regression we predicted numbers, such as the price of a house, and in classification, we predict categories, such as sad/happy, yes/no, or dog/cat/bird.