2.2.11 · D4Linear & Logistic Regression

Exercises — Decision boundaries

1,842 words8 min readBack to topic

Before we start, let us re-anchor every symbol so a newcomer never trips:

Why is the border, one more time in plain words: logistic regression outputs where is the sigmoid . The two classes tie at , and happens only at because the sigmoid climbs strictly upward (never repeats a value). So "" and "" are the same event.

Figure — Decision boundaries

Look at the figure: the amber line is . The cyan arrow is , poking perpendicular to the line toward the class-1 side. Points get a signed distance where is the arrow's length. Positive ⇒ class 1, negative ⇒ class 0. We use division by the length so the distance is measured in real graph-paper units, not stretched by how big we made .


L1 · Recognition

Recall Solution 1.1

WHAT: set the score to zero. WHY: border ⇔ . For : class 1. For : class 0. Answer: boundary at ; class 1 lies to the right.

Recall Solution 1.2

Linear means every feature appears to the first power, no products, no squares. (a) linear ✅ — a straight line. (b) has squares → circle. (c) has a product → hyperbola. Answer: only (a).


L2 · Application

Recall Solution 2.1

Boundary: . Intercepts: set , giving . Set , giving . Classify : class 0. Classify : class 1. See the figure below — both points sit on opposite sides of the amber line.

Figure — Decision boundaries
Recall Solution 2.2

WHY use the length: raw is stretched by how big is; dividing by gives true units. Positive ⇒ class 1, and it lies exactly 2 units on the class-1 side.


L3 · Analysis

Recall Solution 3.1

WHAT: a threshold means boundary at , i.e. . So Orientation: the coefficients of (i.e. ) are unchanged, so the line only slides parallel to itself; its tilt is identical. Raising the threshold pushes the border toward the class-1 region (need more evidence to call "1").

Recall Solution 3.2

Boundary of A: . Boundary of B: . Divide every term by : Identical set of points ⇒ same boundary. Since , wherever we also have ; the factor never changes the zero-set — it only makes the sigmoid steeper (higher confidence away from the line).


L4 · Synthesis

Recall Solution 4.1

WHY squared features: a plain line can never bend; but the same linear rule on new features traces a curve when we plot back in (see Feature Engineering). Want boundary , i.e. . So Classify : class 0 (inside the circle). Classify : class 1 (outside).

Figure — Decision boundaries
Recall Solution 4.2

WHAT: the boundary between two classes is where their scores tie: . For : class A. For : class B. The tie generalises "" — with several classes the border is where two winning scores are equal, not where one score is zero.


L5 · Mastery

Recall Solution 5.1

Step 1 — line direction fixes 's direction. The line through and has equation . So and ; write . Step 2 — the distance fixes the scale . Signed distance of origin: For this is — wrong magnitude. We need , so rescale by the direction only. Set , and require length so distance : That is fixed, so instead we must relax 's tie to the same scale is forced — the boundary line is fixed, so is a fixed geometric number . Therefore a signed distance of exactly for the origin is impossible for this line. Mastery insight: the boundary line already pins the origin's true distance at ; you cannot choose it. Sign (, class 0) is achievable, magnitude is not. Answer: no such exists; the consistent facts are giving .

Recall Solution 5.2

Boundary at threshold : . Invert the monotone sigmoid: So , i.e. . The coefficient vector is untouched ⇒ same normal, same orientation; only the offset changed by . At , , recovering . ∎


Active recall

What single equation gives the logistic boundary regardless of dimension?
(the score ).
Why divide by for distance?
To convert the scale-dependent score into true geometric units, invariant to scaling .
What does raising the threshold to do to the boundary?
Slides it parallel by ; orientation () unchanged.
Boundary of ?
Circle of radius centred at origin.

Connections