This week we will start writing some code! This assignment is designed to be a crash-course to get you up to speed on the level of Python you will need to know in order to do the remainder of the assignments. It’s easiest to learn by doing, so please start early so we can help you get on board. You want to spend the semester focusing on the crowdsourcing and machine learning, not the indenting and semicoloning.
We’ll be using Google Colab to write and run our Python programs. Colab hosts Python Notebooks (also known as Jupyter Notebooks), which are ways combinations of code (Python, naturally) and prose (fancy-pants term for nicely formatted documentation). They’re so good that Nobel-winning economists use Python Notebooks. Colab is awesome because Google lets you use its GPU computers for free (or $10 per month for an upgraded Pro account). GPUs will be useful for our machine learning experiments later this semester.
If you have never programmed in Python before, then I recommend that you watch this Python tutorial on YouTube. The full tutorial is 6 hours long. If you watch the whole thing then you’ll be fully up to speed on Python and you’ll even be able to develop web apps vid Django, which could be useful for your final project.
For this part of the assignment, we’ll ask you to implement several Python functions. These will be automatically graded via a Gradescope autograder. You can submit your code multiple times. The autograder will give you a score, and that’s the score that you’ll get for this homework assignment. There are no hidden tests.
(By the way, the point totals may vary from homework to homework, but each assignment is worth the same as each other assignment when we compute your final grade.)
To being, make a copy of this Google Colab notebook. From the
File menu of Colab, pick
Save a copy in Drive, and you can start working on the assignment. For a tutorial on Python notebooks, download this notebook and walk through it on Colab.
Detailed instructions are given in the skeleton file. Functions that are required for you to implement are in python format. Some examples are embedded as comments for your reference.
You can download the batch.csv here. Once you’ve downloaded it you can drag it into your Colab.
When you’re ready to check your solutions, you can upload your homework3.py file to Gradescope: You can get the python code through the drop-down menu of “File” in the Colab environment. Make sure you don’t have extra print statements or unused code in your Colab notebook, as this could cause your
.py file to fail the autograder.
This homework can also be done in pairs. Only one group member is required to submit the work. Both of you will share the same submission and get the same grading.