Help! Unable to clear week 2 lab assignment in MLS 1

I enrolled in the MLS 1 course with zero experience in coding. I am unable to clear the week 2 lab assignment. I cleared the first part, but am unable to clear part 2: applying gradient descent. I am not sure where I went wrong. I request one of the mentors to help me.

Hello @Krishnaraj1,

Mentors are not like tutors, and what we can do is to give you some suggestions on what you can do to make changes.

This course requires Python knowledge, and if you have no experience in that, I am afraid you need to take a break from the MLS first, and shift your focus to learning Python. Here is some information for you to plan your study in Python.

Please do make a plan, stick with it, and come back after you are confident with Python.


Hi Raymond.

I understand. I will learn python. It is just that the course description did not make this absolutely clear that one cannot pass this course without coding experience. I suggest you mention it clearly that one must have completed some basic level learning in python before attempting this course.

Hello @Krishnaraj1,

Thank you for the suggestion! An alternative would be for us to do both Python and MLS at the same time. Some people would find doing both more effective because you can practice what you have learnt in MLS right the way; while some people would prefer to focus on Python so that it is more intensive and efficient! It is your choice.

Python is useful not just in studying Machine Learning, but it can be very helpful in some daily task that involves a computer. I hope you will find it rewarding soon :slight_smile:


Thanks, Raymond. Yes, that might be good.

If it is possible for you to look up my week-2 assignment submission, please let me know what is the one step I am going wrong in. It repeatedly says dj_db is an error. I feel I am following the steps correctly based on whatever little I managed to grasp about Python.


This is how this place works. When you encounter an error, chance is that it has been discussed previously, and please search this forum for similar post for mentors’ and learners’ comments. Sometimes they might provide you some general debugging steps, and sometimes they might share some very insightful comments. Either way should help you spot the problem. Sometimes this is a lengthy process, and it is especially the case when you are not familiar with Python.

However, we don’t fix problems for learners, because bug-fixing is learner’s resposibility and learning opportunity. We expect learners to allocate enough time, and learn whatever it takes to finish the assignment on their own. It is your job.

If you take this course as the first step to master Machine Learning in the long run, here are my suggestions:

  1. check this post out again, and particularly read part C point number 1 for what you can expect to go through in each exercise.

  2. spend 30 minutes to read through this post. Try to understand the rationale behind this debugging approach, and practice it in your exercises. If you understand what you are doing, and if you print out what your code is doing, then you can compare your understanding with the code. If your code isn’t delivering what are you expecting for, then you spot a place to make correction!

  3. Learn whatever Python that is unclear and is in your way.

@Krishnaraj1, this is not a solution to the error in your assignment, but this is a solution to learning Machine Learning here. If you don’t have the time for this, then please come back later when you have the time. If you have the time for this, try!



Thank you, Raymond.

I am following your suggestions patiently. And doing whatever I can to learn Machine learning, as you have suggested. I have also agreed in a previous post that I will learn Python & come back.

I think you should perhaps stop being so opinionated about my efforts to learn and reserve your judgments. The tone of your email is very unfriendly and sounds like unnecessarily reprimanding someone who is only making a sincere attempt.

I understand it is quite natural for mentors to lose patience catering to the requests of many other learners like me, who come here with little to no coding experience. But that is because we were not sure what to expect in this course. All of the labs are marked as ‘optional.’

So, if you cannot cater to my requests, that is fine. A single sentence ‘I might not be able to help you in this; please read other community posts and see if you find the necessary help’ would suffice. I am smart enough to understand that. Thank you.

Hello @Krishnaraj1,

I meant no offence. I will take your opinion seriously. Thank you!


Thanks, Raymond.

I wish to make a suggestion to the course developers:

It might be good to have short lab videos & ‘coding quizzes’ just like you have the subject matter videos and quizzes. Maybe, multiple choice questions like:

  1. Which of these options is the right way to code for dj_dw_i?’
  2. Identify the one step that creates an error in this coding sequence.

This way, we will learn step-by-step whatever little bit of coding is needed to successfully complete this course. It feels intimidating to suddenly go through an hour-long optional lab which is inundated with information.

It does feel disappointing to spend some weeks watching videos, taking notes, completing quizzes, etc., only to realize that I am not equipped to complete two assignments which will ultimately decide whether I pass this course or not. Aside from that, I have truly enjoyed Andrew Ng’s teaching style; I have learned much from a theoretical perspective.

Hello @Krishnaraj1,

Sure. I am going to share your post with the course team. Thank you for your suggestions!


Hi @Krishnaraj1,

I just posted this on algorithm for beginner and I want you to be the first one to know about it. I am NOT a Python teacher so it might not be very well written, so I have also included some online references there.

The idea of that post is to share how we can think when converting ideas into code. We have to do a lot of these kinds of conversion in MLS’s exercises, and actually in everyday Python work. I believe you are learning Python, but some beginner courses’ focus are on syntax. Personally, I think learning the syntax and using the learned syntax to implement algorithms are equally important. That’s why I have written the post. My examples are based on what will be used in the MLS, so it might look incomplete compared to more comprehensive courses.

Good luck to your learning journey, and cheers!

1 Like

Hi Raymond.

Thanks so much for this. :pray::slightly_smiling_face: