WHY 0.5? Because for two classes the probabilities sum to 1. They are equal exactly when each is 0.5. On one side P(y=1)>0.5 (predict 1), on the other P(y=1)<0.5 (predict 0). The knife-edge is the boundary.
Step 1 — Set the boundary condition.
We want P(y=1∣x)=0.5.
Why this step? By definition the boundary is where the two classes tie, and the tie sits at 0.5.
Step 2 — Invert the sigmoid.σ(z)=21⟹1+e−z1=21⟹1+e−z=2⟹e−z=1⟹z=0.Why this step? The sigmoid is monotonic, so its value 0.5 corresponds to exactly one input, z=0. This converts a probability condition into a clean linear condition.
Step 3 — Write the boundary equation.w⊤x+b=0Why this step?z=0is the boundary. This is the equation of a hyperplane (a line in 2D, a plane in 3D).
WHY linear? Because σ only reshapes a linear score z into a probability. The shape of the boundary is decided entirely by where z=0, and z is a straight-line function of x. The sigmoid bends the probabilities, not the boundary.
If the true separation is curved, feed nonlinear features into the same linear machinery.
Example: add x12,x22,x1x2. Then
z=w0+w1x1+w2x2+w3x12+w4x22+w5x1x2=0
is linear in the weights but a conic (circle/ellipse/curve) in the original (x1,x2) space.
Imagine drawing a line on the playground with chalk. Kids on the left are "Team Red", kids on the right are "Team Blue". The chalk line is the decision boundary — it's the fence deciding which team you're on. The computer's "how sure am I?" meter reads 50/50 exactly on the line, and gets more confident the farther you walk away from it. If a straight chalk line can't separate the teams (say Reds are in a ring around Blues), we let the computer draw a circle instead by looking at fancier clues like "distance from the center."
Dekho, decision boundary ka matlab simple hai: ye wo "line" (ya surface) hai jahan model exactly confuse ho jaata hai — dono class equally likely lagti hain, yaani P(y=1)=0.5. Ek taraf model bolega "class 1", doosri taraf "class 0". Ye boundary hi decide karti hai ki tumhara model kaunsa shape separate kar sakta hai.
Logistic regression mein boundary nikaalna easy hai. Probability output σ(z) hai, jahan z=w⊤x+b. Boundary pe P=0.5, aur sigmoid 0.5 tabhi deta hai jab z=0. Toh boundary ka equation ban jaata hai w⊤x+b=0 — ye ek seedhi line (ya hyperplane) hai. Yaad rakho: "Zero is the border." Sigmoid curve dekh kar mat socho ki boundary bhi curved hai — sigmoid sirf probability ko bend karta hai, boundary flat hi rehti hai.
Agar data curved separation maangta hai (jaise ek class doosri ke aas-paas circle mein), toh ghabrao mat — bas nonlinear features add kar do jaise x12,x22. Tab z=x12+x22−4=0 ek circle ban jaata hai. Trick ye hai: boundary hamesha feature space mein linear hoti hai, bas original input mein curved dikhti hai.
Ye concept isliye important hai kyunki interviews aur exams mein log yahin galti karte hain — sochte hain logistic regression ka boundary curved hota hai. Sahi jawab: linear, unless tum features nonlinear banao. Iss ek clarity se tumhara aadha chapter clear ho jaata hai (80/20 rule).