Assertion error coming in the first assignment. How to solve

AssertionError Traceback (most recent call last)
2 w, b = initialize_with_zeros(dim)
----> 4 assert type(b) == float
5 print ("w = " + str(w))
6 print ("b = " + str(b))


And I got
NameError: name ‘train_set_x’ is not defined
NameError: name ‘test_set_x’ is not defined
NameError: name ‘logistic_regression_model’ is not defined
errors also. How to elimiminate them?

1 Like

Please run all the above cells.

1 Like

Thank you. After running all the cells, name is not found errors are eliminated. But, the assertion error remains

Dear @Mr.Shaik_Jhani_Bhash,
Welcome to the Discourse Community. Thank you for your post. Below is the reason why you are getting an assertion error and a solution to your assertion error.

The AssertionError is being raised because the value of b is not a float. The value of b is an integer. You can fix this by changing the line of code that initializes b to the following: b = 0.0
also consider np.zeros while initializing b

I hope I was able to help you. Please feel free to post a followup if you feel uncertain.

b should be float, not an int.

1 Like