Model Basics
In this unit we find out where the intercept and slope from the Regression unit came from. You make a new notebook and live code it with me in class. At the end you push the notebook to your fork. There is no turn-in for this unit.
You need your fork of the class repo with tidymodels installed from the Regression unit.
1. Sync your fork
- 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
Open your Codespace from github.com/codespaces. In the terminal:
git pullCheck that the solution notebook arrived:
ls notebooks/solutionsYou should see 09-lecture-model-basics.ipynb. Do not open it yet. You will build your own copy in class.
3. Add a jlab task
The JupyterLab command is long. A pixi task is a short name for a long command. Add one called jlab:
pixi task add jlab "jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --IdentityProvider.token='' --ServerApp.password='' --config=jupyter_config.py"This writes a [tasks] section into pixi.toml. You only do this once.
4. Start JupyterLab
pixi run jlabYou do not need pixi shell any more. The task runs inside the environment for you.
Open JupyterLab the same way as before. Click the Ports tab, find the 8888 row, and click the globe icon.

5. Make a new notebook
- In JupyterLab, double-click the
notebooksfolder. - Click the + button and pick the R kernel.
- Right-click the new notebook tab, choose Rename, and name it
09-model-basics.ipynb.
We live code each cell together in class. If you fall behind, the finished version is in notebooks/solutions/09-lecture-model-basics.ipynb.
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/09-model-basics.ipynbpixi.toml
- Type a message like
add model basics lecture. - Click Commit.
- Click the … menu at the top of the Source Control panel and choose Push.
Things to know
- Stop your Codespace when you are done to save your free hours.
- Next time, just run
pixi run jlab.