Week 1 first programming assessment

Am John, Iam new here enrolled in Machine Learning; Unsupervised. I was told I supposed to submit my first programming assignment on implementing k-means clustering algorithms and use it for image compression.
Iam just confused of what to do and how to start. I need help Please.

Hi John,

You watch the lesson videos and then usually by the end of the week you have a link to an assignment, which you need to complete and submit. There might be quizzes too which you have to answer to pass.

Thanks for your feed back. I listen to all the videos and attempt at the first quiz. But for the programing assignment to implement k-means clustering in compressing. There was no link. Just to images given one says "original image " and the second one “compressed with 16 colors”.
What am expected to do with the two images given?. thanks

Do we need any special software or app for the assignment. Because I later clicked on the “work in Browser” and it took me to a new tab with series of code to practice.

You only need a browser to complete the assignment. After you clicked “Work in Browser”, as you said, it will bring you to a programming interface called the “Jupyter Notebook” where you can start coding and running the code. Just follow through the instructions in the notebook.

1 Like

ok, thanks for the ides

I’m expected to copy the code & past, since I m not allowed to edit the code. in the assignment column

There are two types of task, both of which use your browser:

Optional Labs:

  • You do not have to add any code, you just run the notebook and observe the results. These are not graded.

Practice Labs (also called “Programming Assignment”)

  • You add your code to some of the functions, test your code, and submit it for grading. Detailed instructions are in the jupyter notebook file.

Week 1 of MLS Unsupervised learning has the k-means programming assignment.

1 Like

@John_Obinna_okorie, if you are new to Jupyter notebooks and want a little more background, you can watch this video from Course 1 of the Machine Learning Specialization: https://www.coursera.org/learn/machine-learning/lecture/lwqzq/jupyter-notebooks.

For the practice labs, you need to run all the code cells, but the only coding you need to do is to fill in the missing parts in the sections marked with the comments:

### START CODE HERE ###
...
### END CODE HERE ###

When you are done, you can press the blue “Submit Assignment” button at the top of the notebook.

1 Like

@John_Obinna_okorie,

Just one more note in addition to Tom’s and Wendy’s.

In an assignment (practice lab), only graded code cells (which requires you to code) are editable, while other code cells are not editable. Such arrangement is to prevent unexpected code changes outside of the marked sections for exercises (that Wendy mentioned). We want to prevent unexpected code changes because it can cause problems to the autograder when it grades our submitted works.

In an optional lab, however, all code cells are editable because we don’t need to submit anything and so there is no need to prevent for unexpected code changes.

Lastly, no matter the code cells are editable or not, all labs (practice and optional) need us to run all of the code cells and to run them in order.

Cheers,
Raymond

Hello ,
Thanks for the assistance, only that am still struggling to do it. I have added my code and clicked on blue bottom to submit but am still having grade 0%. iI do not know what to do can someone directly help me to compile my code because am confused and looking frustrate. Below is what am getting after running . What should i do again. Please help. thanks

First, just so you know, it’s against community guidelines to share the portion of the code you’ve written. It’s OK in this case, since it looks like you’ve just copy/pasted from the hints, but keep this in mind for the future. Instead of sharing your code, you can share the error. If a mentor needs to see more, they might ask you to send them your code in a direct message.

So… what I see here is a couple of issues:
1). It looks like you accidentally indented the “for j in range …” portion too much, it should be at the same indentation level as the line above it. Python is very sensitive to indentation, so you need to be extra careful about it.

2). It looks like you copied the first level of hints, which is not completely finished. You still need to fill in the parts that are marked with comments that say you need to fill in that part. In particular, where it says:

# Your code to calculate the norm between (X[i] - centroids[j])

and

# Your code here to calculate index of minimum value in distance

You need to fill in those parts with your own code. If you need help with that, there are further hints you can click on to get more detailed help.

I hope this helps. If you’re new to python, you might want to take some time to get a little python experience. That could include going back and starting with course 1 (this is course 3). Course 1 gives you a little more gentle intro to python and jupyter notebooks. Beyond this, especially if you are also new to programming, you might want to take some time out to do some background learning for Python. You can check out the “References for self-learning” section of the FAQ for some more specific suggestions:

FAQ References for Self-Learning

1 Like

So what should do now because I do not understand what to do now

I suggest you start by not indenting the “for j …” loop.

1 Like

Exactly! :point_up:
And then replace the comments that start with: # Your code… with your code to do those steps.

If it is not clear what code to fill in after reading the instructions and examples in the assignment, then I suggest taking a break from this assignment and focus on getting a little more Python expertise. Click on this link: FAQ References for Self-Learning for some suggestions.

can anyone tell me where to find the assignment?

@Mouna_alTahhan,
For Week 1 of Course 3 (Unsupervised Learning, Recommenders, Reinforcement Learning), there are two assignments, the “k-means” assignment and the “anomaly detection” assignment. You will find them in regular checklist of videos, quizzes, etc. for the course.
They may be hard to recognize as assignments on first glance, since they have the headings: “Practice Lab 1” and “Practice Lab 2”, but you will notice it says “Programming assignment” in the fine print:

Screenshot 2023-10-10 at 4.25.26 PM

Just select the “k-means” from the checklist, and click on the “Work in Browser” button and that will bring up the Jupyter notebook with the assignment all ready for you to work on.

1 Like