Week 2 Graded Code Lab: Why Not Vectorize?

This inquiry is probably better suited as feedback for the instructors, and not that it matters much for the small data set we have to test against nor seeing as the automatic grader cares more about the final output than the implementation, but does anyone know why we were tasked with writing the coding the two methods/functions using loops rather than vectorizing it?

Considering a big part of this course was emphasizing the efficiency benefits of vectorization and that it is what is typically done in practice, it seems like a great alternative suggestion for those who want to get into the habit of doing so.

Was anyone so “daring” as to vectorize the code from the get go and pass it through the auto-grader?

Hello @Alexander_Sheynis

The lectures are taking the loop approach first, and then the vectorization approach will be introduced later. We encourage learners to go for the vectorization approach, but they can stay with the loop approach if that is their perference. These courses are more like introductory courses and hopefully with both approaches introduced one after another, it will provide more angles for different learners to understand the content.

Cheers,
Raymond

Throughout Andrew’s many courses that are targeted at novice programmers, he recommends starting with for-loops instead of matrix algebra, because it is easier to see what’s going on in detail.

You can certainly write the code using matrix algebra, if you’re comfortable with that.

The grader never looks inside your code - it just tests the return values.

1 Like

Thank you both for your responses. That is what I figured. Would it be reasonable to add a note that those taking the course can instead write in their code vectorized if desired for practice? The directions as stated seem to indicate the contrary even though the autograder only tests the return values.

I am somewhat a novice to “machine learning” but have experience programming. What are other courses you would recommend to someone with more of an intermediate level or could quickly pick up an intermediate level? One of the reasons I am taking this series is to gain a skill set that many jobs I am interested are looking for so if there are other courses/series that will expedite my expertise, I would appreciate knowing about them.

Hello @Alexander_Sheynis,

The MLS courses are designed for Machine Learning beginners, so to this end I think it might be suitable for you. As for courses specifically for those who have experience in programming, I don’t really recall any of that which is as entry-level as the MLS. However, if you happen to find any, please do share it with us so that we can refer future learners to your post.

In the mean time, perhaps one suggestion would be for you to spend more time on the concept side, adjust the pace to a level that is comfortable for you when it comes to the code part, and implement the exercises in the way you prefer.

With your experience, you probably can finish the MLS faster than many other learners and then ready to move on to some more advanced Deep Learning courses. What’s more is that, there is also a chance that you can finish the MLS faster than finding and finishing another more suitable course. :wink:

Cheers,
Raymond

Definitely. The concepts and language of machine learning are great to pick up from this class and seeing some of the basic and essential algorithms that provide the framework of machine learning. I am not jumping ship on this course, but curious what could come next. Understandably, the best way to learn is to practice but I have been having difficulty finding access to data or problems to work on independently and build up a portfolio of sorts of machine learning projects. If you have an recommendations on that front, as always I’m all eyes. Thanks again!

We usually recommend the deep learning specialization as the next one which covers more use cases (and architectures) of deeper neural networks and relevant techniques. You will still see loops there but it should be less :grin:.

Kaggle is a great place to go to because it has datasets from toy-like to actual business’s and in many different aspects, there are also discussions that we can learn from, and sometimes there are notebooks that we can reference to. Just like we would do research for any new dataset in our hands, Kaggle’s community is just one handy source for that. The downside is that things are not well organized so that we will really need to do all those gathering works ourselves, but this is life, isn’t this?

Kaggle also has the leaderboard that you can compete for, but my suggestion would be not to spend too much time on that especially when the top places are filled with teams that share almost the same score.

Unless you have a special field that you are interested in, Kaggle is a good place to go for general datasets.

Cheers,
Raymond

Thanks for that information. I’ll check out Kaggle on the side. I don’t mind doing a little questing and organizing myself. Few things in life are handed to us prepared nicely… heck most large data sets are messy and need some cleaning up.