Tutorials form deep learning course

Hi.
Sorry for being lazy… Are there tutorials for programming assigments as there were in the machine learnig course?
Is there any further explanation of tasks?
thank you!!

No, there are no separate tutorials, although the very first assignment in Course 1 Week 2 is structured as a tutorial on numpy.

I think you’ll find that the instructions in the assignments are quite complete and detailed. They also give you “templates” for most of the code, e.g. the function definitions and the basic structures of the code. You just have to fill in the key portions of the algorithms. Give it a try and let us know how it goes.

Thanks Paulin.
The point is that I get an assertion error on exercise 1 (the cats one) and I don’t know how to solve this kind of problems.
I’ll try to paste what ist mentioned:
"AssertionError Traceback (most recent call last)
in
6
7 assert type(grads[“dw”]) == np.ndarray
----> 8 assert grads[“dw”].shape == (2, 1)
9 assert type(grads[“db”]) == np.float64
10

AssertionError:
"
Sorry for abusing but any help will be apreciatted.
Thanks.

Well, debugging is part of the job of being a programmer, right? I’ve been writing code since I was 14 years old and I’m over 70 by now and I can still count on the fingers of one hand the times I’ve written a piece of code longer than one or two lines and had it work the first time. :nerd_face:

You start with the error and then you work backwards: that error is telling you that your dw value is the wrong shape. It’s supposed to be (2, 1). So the first question is “what shape is it?” You can find that out by adding a print statement after you compute dw:

print(f"dw.shape = {dw.shape}")

Ok, now the next question is “how did it get that way?” Knowing the wrong shape you got would be a clue. But maybe the first step is to go back and look at the math formula for dw and compare that to your code. You must have misinterpreted something about what the formula says.

2 Likes

Thanks :smiley:
The age is not important is what you do with your time. Here there is an examle lol.
I am going to try that things. Thank you very much.

Here’s the formula for dw:

dw = \displaystyle \frac {1}{m} X \cdot (A - Y)^T

Notice that the operation between X and (A - Y)^T there is a dot product, not an elementwise multiply. Note also that I made a little “enhancement” there to the notation that Prof Ng uses in order to make that more clear. If you used * or np.multiply there, you would have gotten an error, so that’s probably not the problem.

Here’s a thread about how to tell when to use dot product versus elementwise multiply. That thread is also linked from the DLS FAQ Thread, which is a worth a look if you haven’t seen it yet.

Thank you Paulin, sorry for the late response.