# Are z values in Sigmoid function/logistical regression lab simplified?(C1_W3 lab)

First post!

I had a quick question regarding where the values of z came from in the logistical regression lab code using Python. I am working on Lab “Optional lab: Sigmoid function and logistic regression.”

I read several posts on here from prior years that were quite helpful, but I couldn’t find the exact answer to this question.

The lab states: “In the case of logistic regression, z (the input to the sigmoid function), is the output of a linear regression model.”

The equations in the course demonstrate this statement pretty clearly by subbing z for w.x + b.

However in the lab z does not actually include the code for the output of the linear regression model. Instead z is a manually inputted array of numbers. First example is: “# Input is an array.
input_array = np.array([1,2,3])
exp_array = np.exp(input_array)”

And in the second example that is actually used for the lab data, z (or “z_tmp” here) is also a user entered value:
"# Generate an array of evenly spaced values between -10 and 10
z_tmp = np.arange(-10,11)

#Use the function implemented above to get the sigmoid values
y = sigmoid(z_tmp)"

Is this just a simplification in the process for purposes of the lab (e.g. that we theoretically already found these z values prior from running w.x +b)?

Instead of the sigmoid(z) function using “g = 1/(1+np.exp(-z))”, I was expecting it to actually include the slope intercept formula for z.

Something actually more like “g = 1/1+np.exp(-(np.dot(w, x) +b))”

Thanks!

Realized I’m missing a parenthesis here but same thing:

Something actually more like “g = 1/(1+np.exp(-(np.dot(w , x ) +b)))”

It’s not a simplification - it’s just a test case.

1 Like

Sigmoid is just one of many activation functions that you might use. To make it easy to swap functions, it’s traditional to compute the linear combination first, and then apply a separate activation.

2 Likes

Ok cool that makes sense. Thanks so much for replying

1 Like