I wrote the code but has some error. Please tell me how to fix this?
{moderator edit - solution code removed}
Find the type of b, it may not be just float, it may be numpy.float64…
Just a comment on your code (which you should not post on the forum, that’s not allowed).
You don’t need the second line of code that re-casts b as np.float64.
If that’s the necessary data type, you can include that in the dtype specifier in the np.zeros() call.
But I do not think that’s the correct type in any case.
The error message is pretty clear: it’s telling you that b is supposed to be floating point 0., but you can see from your print results that it ends up being floating point 2. So why did that happen?
Note that in both the w case and the b case, you are setting them to be a shape. That’s not what you want: you want to set them to values that are in the right shape.
That means you must have restarted the notebook, but haven’t yet run the earlier cells. Do “Cell → Run All Above” and then try again. Where is “np” defined? It’s in the “import” cell earlier in the notebook, right?
This was all covered in the lecture “A Quick Tour of the Jupyter Notebooks”, I think.
{moderator edit - solution code removed}
Thank you. Done)
Hello @Max_Adamchuk! Happy to hear that you passed the test. However, Tom mentioned to you that:
Just a comment on your code (which you should not post on the forum, that’s not allowed).
But I noticed you shared your code again and again, a total of 4 times. This behavior will lead to suspending your account and you will not be able to ask for help in the future. So, take Tom’s point seriously and avoid sharing your code. You just need to share your full error and if mentors need to see your code, they will ask for a private/direct message. Here is the community code of conduct.
Best,
Saif.