Np.dot-less Forward & Backward Propagation

While I recognize the conciseness of the standard forward- and backward-propagation Python code used in this course, I submit below a version of these algorithms grounded in, I believe, a more explicit expression of the underlying linear algebra basis which, for me at least, provided a more concrete understanding of the algorithm. I would like to know if the standard code and my version are indeed equivalent or where I have misunderstood the algorithms. Having tested them fairly thoroughly, I strongly believe they are equivalent, but am not quite confident enough to insist it is so.

[Moderator edit: Code removed]

Hi, @Marshall_Mayberry.

Yes, naturally. As a general principle, there are multiples syntaxes to achieve the same ends. For example, you seem to prefer the @ symbol for matrix multiplication while the course teaches the use of the np.dot() function. As far as passing the unit tests, I cannot see where its proper use would end up in an exception being thrown.

That said, some cases where you think that your code is more elegant or computationally efficient, an error may be produced. We simply cannot write the test code to be robust to all implementations.

Note: I have removed your code from the post. Sorry, but this was a close call. Although you were not explicitly serving up code from a course exercise, there was enough there to assist other learners to solve course exercises on the cheap. The real learning occurs in the struggle. I came across an apropos quote the other day: “One must imagine Sisyphus happy.” :nerd_face:

Okay. Thanks for taking a look at it.