Homework Setup

Environment, Starter Code, and Data

Assignments with starter code ship as a zip. The unzipped directory is your repository root.

Environment

Create a virtual environment per assignment and install the starter’s requirements.txt:

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Starter Code

unzip hw5-starter.zip
cd hw5-starter
git init
git add .
git commit -m "starter"

Do not nest the unzipped directory inside another directory.

Data

python generate_datasets.py --seed 541

creates data/ with placeholder copies of the assignment’s data files: the right names, keys, shapes, and dtypes, but random content. Download the real files from the assignment’s Data link into data/ to replace them before producing anything you submit. data/ is excluded by the starter’s .gitignore; do not commit it.

Running a Problem

Run each problem’s script from inside its directory:

cd q1
python -m pytest test_interfaces.py
python logistic.py

The tests check shapes and conventions on small hand-computed cases and pass without the real data. Each script writes its output files next to itself; those files are what the assignment’s Submission tree lists.

Notebooks

You may use a Jupyter notebook to explore, but the graded code is the .py file. Keep the notebook outside the problem directory and import from the module:

import sys
sys.path.insert(0, 'q1')
from logistic import sigmoid, predict_proba, train

Do not submit a notebook in place of the script.

See How to Submit for repository structure and Gradescope.