Machine learning specialisation issue query

I seem to have a few issues with the course. Currently on week 2

  1. Unable to ‘run’ the codes in optional labs. They are giving errors while running (attached). Because of that, the optional labs are very difficult to follow

  2. Although I am really enjoying the course, I find it rather disheartening when I have to do the optional lab. I can’t understand most of the code or be able to run it because of the issue above. I have very very basic knowledge of python or programming in general. Can I check if Python is a prerequisite for this course? Or what would be recommended learning after this or parallel to this so that I can fully understand the codes as well?

I do really enjoy the theory and I would like to be able to understand and code correctly. Much appreciate your help with the above questions.

Hi Merlin, welcome to the community!

The problem you’re encountering here, where np is not defined, is due to the missing import statement for NumPy. Please run all cells from the beginning. Make sure you start from the beginning next time to avoid these errors. This will import the NumPy library and allow you to use np as an alias for it, making functions like np.array, np.sum, and np.mean accessible.

If you’re new to Python, you may find it beneficial to learn some basic Python programming skills. A basic understanding can be very helpful, especially since the course relies on Python to implement Machine Learning algorithms.

P.S. Please edit your post. Posting solution code in a public topic is against our Community Forum Code of Conduct (Code of Conduct - DeepLearning.AI ). It’s okay to share stacktrace in a public post and to send code to a mentor via direct message if they ask for it.

Hope this helps!

1 Like

Thank you. I have deleted the screenshot with code in it.
Regarding Python course- I am nearly at the end of AI Python for beginners. Are there courses by Andrew Ng which is traditional way to learn Python programming for beginners here or on coursera

2 Likes

@Newbycoding @nadtriana may have a different suggestion, which I am sure is equally as good-- but if you mean ‘traditional’, I highly recommend this two course series.

Be aware though it is not a walk in the park and requires a serious commitment of time. But you will really get to know both ML/Python.

2 Likes

There are a few ways to continue building your Python skills. Consider beginner-friendly courses such as Dr. Charles Severance’s Python for Everybody on Coursera, or resources at W3Schools and Real Python that cover the basics of Python.

Prof. Andrew Ng’s courses, such as the Machine Learning Specialization or the Deep Learning Specialization, assume some familiarity with Python but emphasize applying Python to machine learning concepts rather than teaching it from scratch. For basic Python skills, the courses above are a better fit.

2 Likes

Thank you. Looks like a great option. Planning to sign up

Thank you for the advice. Much appreciate it.

1 Like