Search code examples
machine-learninglogistic-regression

Confused about the decision boundary of logistic regression binary classifier


I haven't been able to solve a question. In the question, the hypothesis function, H, is given by

H(x) = g(B0 + B1*X1 + B2*X2)

where

B0 = 6, B1 = 0 and B2 = -1

And I am given these figures:

enter image description here

And the question is that which figure will represent the decision boundary given by the classifier. The answer is figure B but I don't quite get why. Can someone explain to me why this is so?


Solution

  • If you've taken the threshold value of 0.5 to classify, what you get is:

    g(z) > 0.5 ---> predict y = 1 => z > 0
    g(z) < 0.5 ---> predict y = 0 => z < 0
    for the first case if we take the relation z > 0, we get:
    B0 + B1*X1 + B2*X2 > 0
    6 + 0*x1 + (-1)*X2 > 0
    X2 < 6
    

    Therefore, with X2 < 6 you must predict y = 1 and with X2 > 6 you must predict y = 0