Hello,

I’m having an issue that I cannot troubleshoot. I added the code to compute the cost with logistic regression. Running, the complaint is about the variable X itself, which is passed as an argument to compute_cost. Please see below.

They are both uppercase and with the correct indentation.

I ran all the code prior to this. Any suggestions are appreciated!

```
# UNQ_C2
# GRADED FUNCTION: compute_cost
def compute_cost(X, y, w, b, *argv):
"""
Computes the cost over all examples
Args:
X : (ndarray Shape (m,n)) data, m examples by n features
y : (ndarray Shape (m,)) target value
w : (ndarray Shape (n,)) values of parameters of the model
b : (scalar) value of bias parameter of the model
*argv : unused, for compatibility with regularized version below
Returns:
total_cost : (scalar) cost
"""
m = n = X.shape
### START CODE HERE ###
total_cost = 0.0
for i in range(m):
z_i = np.dot(X[i],w) + b
f_wb_i = sigmoid(z_i)
total_cost += -y[i]*np.log(f_wb_i) - (1-y[i])*np.log(1-f_wb_i)
total_cost = total_cost / m
### END CODE HERE ###
return total_cost
```

NameError Traceback (most recent call last)

in

14 “”"

15

—> 16 m = n = X.shape

17

18 ### START CODE HERE ###

NameError: name ‘X’ is not defined