Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Flashcards: open the module flashcards (end-of-module review with workplace questions).

Online Courses / University Track / Learning from Data

Module 4 · Lesson 4 · Core

Linear separability and the limits of a straight boundary

Decide whether one straight line can separate two classes and see what to do when it cannot.

  • 50 minutes
  • Serves O4
  • Assumes M4.L3

Phase 1: Prepare

Step 1 Warm-up recall

From M4.L3: what does a larger k do to the boundary?

Private: nothing you type here is sent or stored.

Step 2 Learning goal

By the end of this lesson you can:

  • say what linearly separable means (Foundation);
  • test small examples for separability (Core);
  • explain the trade-off of a more flexible boundary (Core).

Phase 2: Teach

Step 3 A familiar example

A security system should raise an alarm when exactly one of two sensors is triggered, but not when both or neither are. No single straight cut through the sensor readings can express that.

Step 4 Clear explanation

Two classes are linearly separable if some straight line puts all of one class on one side and all of the other on the other. Cases such as (1, 1) and (2, 2) in one class and (4, 4) and (5, 5) in the other are separable: the line x + y = 6 does it, since the first class has x + y of 2 and 4, and the second has 8 and 10.

Now take the exclusive-or table, where the answer is Yes only when exactly one input is 1.

Input 1Input 2Class
00No
11No
01Yes
10Yes
Separable: one line is enough0Not separable: no single line works1Fix: curved boundary or new features2Linear separability
Some problems cannot be separated by one straight line. The exclusive-or table above is the classic case: the two Yes points sit on opposite corners.

The two Yes points are on opposite corners of a square, and so are the two No points. Any line that puts both Yes points on one side also catches a No point. A linear classifier, including the simple scoring rule of Lesson 2, cannot get this table right.

There are two ways out. One is a more flexible boundary, such as the curved or ragged boundary that nearest neighbours produce. The other is to build a new feature from the old ones: add one that equals 1 only when both inputs are 1, and the classes become separable.

Flexibility has a price. A boundary that bends to fit every training case can score 100% on those cases and still do badly on new ones. Module 5 shows how to detect that.

Step 5 Worked example (4 marks)

Four points are (1, 1) class X, (5, 5) class X, (1, 5) class O and (5, 1) class O. Can one straight line separate them?

  1. The two X points are on one diagonal and the two O points on the other. (1 mark)
  2. A line that keeps (1, 1) and (5, 5) together must pass between them and crosses the diagonal where an O point lies, or leaves an O point on their side. (1 mark)
  3. So no single line works; this is the exclusive-or pattern. (1 mark)
  4. Answer: not linearly separable. (1 mark)

Go deeper: the professor's notes

One straight line cannot separate every pattern, so test separability and check flexibility on unseen cases.
Separable

One line.

XOR

No line.

Overfit

Check.

Plotthe casesTrya lineIf noneflex or add featureTestunseen cases
Limits

Exclusive-or

Input 1Input 2Class
00No
11No
01Yes
10Yes

At work: Sensors

Alarm only when exactly one sensor fires.

  1. Plot the four cases.
  2. Look for a separating line.

What a careful practitioner decides. No single line works, so change the boundary or the features.

Phase 3: Practise

Step 6 Learner practice (instant-marked)

1. Linearly separable means:

2. The exclusive-or table is:

3. A way to handle a non-separable pattern is to:

4. A boundary that fits every training case perfectly may:

Phase 4: Close

Step 7 Recap

  • Linearly separable means one line splits the classes.
  • Exclusive-or is not separable by one line.
  • Flexible boundaries and new features help, but fit on training data can flatter.

Step 8 Exit ticket (ungraded)

Points (0, 0) and (1, 1) are class A and (4, 4) and (5, 5) are class B. Is one line enough?

Private: nothing you type here is sent or stored.

Step 9 Go further (Extension)

Think of a real decision where the right answer depends on exactly one of two conditions.

In industry: The limit was narrower than the legend

The 1969 result applies to single-layer perceptrons. Minsky and Papert already knew that networks with extra layers could handle patterns such as exclusive-or, and a second layer is enough to solve many non-separable problems. Reading the book as a ban on all neural networks was a mistake that affected research funding for years.

Link to this lesson. Report a limit exactly as far as the evidence goes: a flaw in one kind of model is not a flaw in every model.

Source: Perceptron, Wikipedia; Cornell Virtual Workshop, The XOR problem

Common mistakes

MistakeWhy it fails
Assuming a line always worksCheck by plotting or by trying small cases.
Adding flexibility without testingCheck on cases not used to fit.
Ignoring useful new featuresA new feature can turn a hard problem into an easy one.

Limits. Real data are usually not perfectly separable, so the aim is the fewest mistakes on new cases.

Flashcards for this lesson (3)

Tap a card to reveal the answer. Read the question, answer it aloud or in writing first, then check yourself against the explanation.

Card 1 of 3 · What does the choice of k do?
k = 1noisyLarge kblurredTeston unseen
Choosing k

A small k follows noise because one odd case decides. A large k blurs real differences. Choose k using cases not used to fit.

Card 2 of 3 · What is linear separability?
One lineenoughPlotfirstChecksmall cases
Separable

Two classes are linearly separable if one straight line puts all of one class on one side and all of the other on the other.

Card 3 of 3 · What is the exclusive-or problem?
Yes(0,1) and (1,0)No(0,0) and (1,1)No lineworks
Exclusive-or

The class is Yes only when exactly one of two inputs is 1. The Yes cases are on opposite corners, so no single line works. A curved boundary or a new feature solves it.

Review with flashcards

Test yourself on this module with workplace flashcards and detailed answers.

Open the module flashcards