I’m getting this error since yesterday even though I’ve followed the hints completely. Could you please help me out?
ValueError: setting an array element with a sequence.
Error -
36 # Apply the threshold
—> 37 p[i] = (f_wb>= 0.5)
38
39 ### END CODE HERE ###
m, n = X.shape
p = np.zeros(m)
### START CODE HERE ###
# Loop over each example
for i in range(m):
z_wb = 0
# Loop over each feature
for j in range(n):
# Add the corresponding term to z_wb
z_wb += np.dot(X[i,j],w)
# Add bias term
z_wb += b
# Calculate the prediction for this example
f_wb = sigmoid(z_wb)
# Apply the threshold
p[i] = (f_wb>= 0.5)
### END CODE HERE ###
return p