That is called the cost function, we want to minimize the cost regarding to the choice of hw ( we can think hw as w0, w1 … etc).

For simplicity, let’s assume we have just w0, and w1 , thus J(hw) becomes J(w0,w1).

So we need to find a point on ( w0,w1) planet which minimize J(w0,w1).

Using the gradient descent ( on (w0,w1) planet), we can easily find that point!

Use cases:

Use simple logistic regression when you have one nominal variable with two values (male/female, dead/alive, etc.) and one measurement variable. The nominal variable is the dependent variable, and the measurement variable is the independent variable.

Use multiple logistic regression when you have one nominal variable and two or more measurement variables, and you want to know how the measurement variables affect the nominal variable. You can use it to predict probabilities of the dependent nominal variable, or if you’re careful, you can use it for suggestions about which independent variables have a major effect on the dependent variable.

For example, you might want to know the effect that blood pressure, age, and weight have on the probability that a person will have a heart attack in the next year.