Machine Learning Specialization: Regression and Classification : Course 1 Week 3 : Optional Lab 02

I have noticed that in this Optional Lab, under the heading Sigmoid or Logistic Function there is the following function defined;

f_{w, b}(x^{(i)}) = w \cdot x^{(i)} + b

However, further down under the heading Logistic Regression there is the same function but defined differently;

f_{w, b}(x^{(i)}) = g(w \cdot x^{(i)} + b)

where g(z) = \frac {1}{1 + e^{-z}}

So am I confused. Would it not be clearer to use different notation for the second function definition to make it clear that this is a different function?

For example;

h_{w, b}(x^{(i)}) = g(w \cdot x^{(i)} + b)

Also, I have noticed that the variable y is used to denote the output label that can only take the value 0 or 1, however in the final plot of this Optional Lab, in the bottom right-hand corner I can see the following expression;

y = sigmoid(z)

I am assuming Prof. Ng means g(z) here and not sigmoid(z) as he hasn’t defined what that means but more importantly, the output value from g(z) is \hat y and not the variable y.

In the first video lesson of Course 1 Week 3 “Motivations”, at 6mins 8 secs, Prof. Ng talks about y equaling 0 or 1 when in fact on the plot in the video it is written as \hat{y}, adding to the confusion.

1 Like

Yes, it would.

Andrew tends to use the g(…) to indicate any activation function. Usually it means sigmoid(…).

I have no idea what an “…activation…” function is. It’s not referred to in the course - so far.

Also the sigmoid function is defined mathematically as;

\sigma (x) = \frac {1}{1 + e^{-x}}

Although Andrew uses the notation g(z) instead.

But sigmoid(x) isn’t actually defined as the sigmoid function strictly speaking.

I think it is best to adhere to the notation g(z) as that is what is used in the course so that we are all on the “samepage” so to speak.

1 Like

In software land, ‘z’ is whatever parameter you pass to the sigmoid() function. It’s the typical variable name used in the Python function definition

One has to be a little flexible when discussing these topics, given the lack of universal standards, and the huge number of different participants in the discussion form, each with different backgrounds.

2 Likes