Homework Policy

Keep Practicing!

There will be a total of eleven homework assignments in CS 307. Homework assignments are administered through PrairieLearn. These homework assignments will serve as practice for the exams.

To access CS 307’s PrairieLearn content, simply navigate to prairielearn.org and add the course.

Question Types

Questions on homework assignments will take one of four possible forms:

  • Checkbox questions will present a series of statements and students will be asked to check a box for each “correct” statement. These questions generally attempt to assess conceptual understanding.

  • Numeric questions will ask students to input one or more numeric quantities.1 These questions generally attempt to assess mathematical understanding.

  • Code questions will ask students to submit Python code to be graded. These questions generally attempt to assess algorithmic understanding.

  • Model Fitting questions will ask students to submit a learned model for grading. These questions generally attempt to assess applied understanding.

Grading and Deadlines

Homework assignments in CS 307 are low-stakes assignments with unlimited attempts. There is no penalty for submitting incorrect answers on homeworks. When making a subsequent submission on a question, your score on that question can never decrease.

Timeout

All questions on homework assignments will have a one minute timeout between possible submissions. This timeout exists to encourage a number of good habits:

  • Checkbox questions: it should deter you from simply attempting to brute force a solution.
  • Numeric questions: it should encourage you to check your work before submission.
  • Code questions: it should encourage to test your functions yourself before submitting.
  • Model fitting questions: it should encourage you to do your own validation before submission.

Said another way, the timeout exists to prevent you from developing bad habits that will cause you to suffer during exams.

Partial Credit

Partial credit is available for most questions.

  • Checkbox questions: each individual checkbox provides \(1 / n\) points for a question with \(n\) total checkboxes.

  • Numeric questions: partial credit is based on which inputs you supply correctly for questions with multiple inputs.

  • Code questions: submitted code will be checked against several distinct test cases, which each provide some portion of the total credit.

  • Model fitting questions: submitted models will be assessed by various metrics, and partial credit will be awarded as a function of your distance from the given thresholds for each metric.

Python

You are allowed and expected to use Python to solve many homework problems.

VSCode Workspaces

You may complete homework assignments by using Python however you like. Mostly, we recommend using VSCode with the remote setup that we have described in the computing policy instructions.

However, because exams will be completed in the CBTF, you will only have access to VSCode and Jupyter notebooks through PrairieLearn to complete your exams. It would therefore be a good idea to practice using VSCode through PrairieLearn for some of your homework assignments.

The first question of each homework (and exam) will provide access to a VSCode workspace. Within the workspace for homework xx, you will be given a Jupyter Notebook named homework-xx.ipynb in the left panel. This notebook will contain definitions, formulas, etc, that you are not expected to memorize. Use this notebook for any Python coding needed to complete checkbox, numeric, or code questions.

As you practice using VSCode through PrairieLearn, please pay close attention to the available keyboard shortcuts. For docstring access, use ?. For example, place ?np.mean in a cell of a notebook and run that cell to obtain documentation about the np.mean function provided by the numpy package for Python.

Model fitting questions will have workspaces specific to those questions.

Rounding and Precision

Do not round or truncate any calculations. When submitting answers to numeric questions, copy-paste all digits reported by Python. Do not attempt to change the default number of digits that Python displays. If for some reason you feel that you have the correct answer, but it is not being accepted by the autograder due to a precision issue, please alert the course staff. Again: do not modify the number of digits that Python displays!

When Python prints a number, it is often only showing you some of the precision that it has stored.

import numpy as np
print(np.pi)
3.141592653589793

Obviously, we know that \(\pi\) has many more digits than this. Are these all the digits Python uses when you use np.pi for a calculation? Nope! These are the digits that Python displays by default; many more digits are stored internally and used by Python in subsequent operations behind-the-scenes.2

print(f"{np.pi:.25f}")
3.1415926535897931159979635

Due to this behavior, you should never copy-paste Python output then re-paste it into a script. Doing so will cause you to accidentally lose precision!

As an aside, working with floating point numbers in computers is difficult.

0.1 + 0.2 == 0.3
False
0.1 + 0.2
0.30000000000000004

The above results are unfortunate, but not surprising. They are simply a consequence of floating point arithmetic. For more information:

As student in CS 307, this is not something you actually need to worry about as long as you never round any calculations.3

Footnotes

  1. See the note below about rounding answers. TLDR: never round anything.↩︎

  2. Interestingly, for many applications, only a few digits of \(\pi\) will get the job done!↩︎

  3. But it does serve as a reminder to the instructors that they need to use np.allclose instead of np.array_equal to make comparisons in the autograder.↩︎