Regression
In this unit you fit your first models. We use tidymodels, a set of R packages for fitting models the tidyverse way. The lecture is a notebook. You pull it into your fork, install tidymodels, and live code it with me in class. At the end you push the finished notebook and turn in the link.
You need your fork of the class repo and the pixi environment from the Codespaces unit.
1. Sync your fork
The lecture notebook is in the class repo, not in your fork yet. To sync is to pull new commits from the class repo into your copy.
- Open your fork on GitHub. The address looks like
github.com/YOUR-USERNAME/codespace. - Near the green Code button, click Sync fork.
- Click Update branch.
If GitHub offers to discard your commits instead, stop and ask the instructor. Do not click it.
2. Pull into your Codespace
Your Codespace does not know about the new commit yet. Open it from github.com/codespaces. In the terminal:
git pullCheck that the notebook arrived:
ls notebooksYou should see 08-lecture-regression.ipynb.
3. Install tidymodels
Add it to your pixi environment:
pixi add r-tidymodelsThis pulls in many packages. It can take a minute or two. Wait for the prompt to come back.
If it fails, run pixi install, then try pixi add r-tidymodels again. If it still fails, tell the instructor.
4. Start JupyterLab
pixi shelljupyter lab --ip=0.0.0.0 --port=8888 --no-browser --IdentityProvider.token='' --ServerApp.password='' --config=jupyter_config.pyOpen JupyterLab the same way as before. Click the Ports tab, find the 8888 row, and click the globe icon. Do not use the Open in Browser popup.

5. Complete the notebook
We will do this together in class. In JupyterLab, double-click the notebooks folder, then 08-lecture-regression.ipynb. We live code each cell as we go.
6. Commit and push
Save the notebook with Ctrl+S. Then go to the VS Code tab:
- Click the Source Control icon on the left bar.
- Stage these files by clicking the + next to each one:
notebooks/08-lecture-regression.ipynbpixi.tomlpixi.lock
- Type a message like
add regression lecture. - Click Commit.
- Click the … menu at the top of the Source Control panel and choose Push.
7. Turn it in
- Open your fork on GitHub and refresh.
- Click the
notebooksfolder, then click08-lecture-regression.ipynb. - Copy the address. It looks like
https://github.com/YOUR-USERNAME/codespace/blob/main/notebooks/08-lecture-regression.ipynb. - Paste it into the Canvas assignment.
GitHub shows the notebook with its outputs. Check that the outputs are there. The notebook is your turn-in for this unit.
Things to know
- Stop your Codespace when you are done to save your free hours.
- Next time you open the Codespace, tidymodels is still there. Run
pixi shelland the JupyterLab command again.