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!