When what you want to predict has only 2 outcomes. For example,

To predict whether an email is spam (1) or (0)

Whether the tumor is malignant (1) or not (0)

Whether the customer will leave (1) or not (0)

What does the data looks like when we plot it?

Why not linear regression?

Data are not forming a line

Relations of x and y are not close to linear

We need another line to "fit" the data

Sigmoid Function

Sigmoid Function

If we find the right t-asix the data will look like a Sigmoid function then we can distingulish 0 and 1

but how?

In linear regression

We find the right (set of) b by mininising the error (the slider game)

Y' = b0 + b1X1 + b2X2 + ...

Root Mean Square Error

Remember how we measure the error of the linear regrestion last time?

Root Mean Square Error

Similar to the sum of error square, the standard way of measure how wrong (cost function) of the model form the actually training data is root mean square error (RMSE)

there for the cost function of linear regression is: