[The material belongs to the Coursera Machine Learning course by Andrew Ng]
I got one of the exercises to work in R (I could have opted for Python - not essential to the
The answer is actually quite easy:
The boundary is at:
0 = theta_0 + theta_1 x_1 + theta_2 x_2
Hence, since the plot is of x_2 versus x_1, we choose two extreme points along x_1 and calculate the expected x_2 at the decision boundary:
x_2
x_1
x_2 = (- 1 / theta_2) * (theta_0 + theta_1 x_1)