Binary classification with the perceptron

Let's work through a toy classification problem. Suppose that you wish to separate adult cats from kittens. Only two explanatory variables are available in your dataset: the proportion of the day when the animal was asleep and the proportion of the day when the animal was grumpy. Our training data consists of the following four instances:

Instance

Proportion of the day spent sleeping

Proportion of the day spent being grumpy

Kitten or adult?

1

0.2

0.1

Kitten

2

0.4

0.6

Kitten

3

0.5

0.2

Kitten

4

0.7

0.9

Adult

The following scatter plot of the instances confirms that they are linearly separable:

Our goal is to train a perceptron that can classify ...

Get Mastering Machine Learning with scikit-learn - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.