BIOS 512: Data Science Basics
👋 Welcome to the Data Science Basics course!
The primary text for this course is Hello Data Science: A friendly introduction with applications. Although we will diverge from the text to explore concepts in statistical modeling and inference.
Lectures
Hello World
Data Visualization
Scales and Theme
Data Wrangling
Data Types
Joining and Pivoting
Exercise: Pivoting Turn in
Pivot the Billboard chart data to rank songs by how many weeks they spent in the Top 10.
Codespaces
Lecture
Fork the class repo, open it in a GitHub Codespace, and build your own R environment with pixi. Read the step-by-step guide.
Exercise: GitHub Account Turn in
Create a free GitHub account. You need one to fork the repo and open a Codespace.
Exercise: Hello World Turn in
Fork the class repo, add a hello world notebook, and turn in the link to your fork. 
AI Pairing
Lecture
Get a key from the class LLM gateway, connect opencode to JupyterLab with MCP, and build a model together. Read the step-by-step guide.
Regression
Lecture
Sync the lecture notebook into your fork, install tidymodels, and fit linear regression models to GSS survey data. Read the step-by-step guide.
Model Basics
Lecture
Find out where model parameters come from. Guess lines, measure their distance from the data, and let optim() search for the best one. Read the step-by-step guide.
Marginal Effects
Lecture
How much does the outcome change when a predictor moves by one unit? Calculate marginal effects from a straight line, from a curve where the answer depends on the value of the predictor, and from a model of log income. Read the step-by-step guide.
Exercise: Education and Marijuana Turn in
Use the same recipe on a yes/no outcome with your AI assistant. Push it with the submit prompt, and turn in the link.
Logistic Regression
Lecture
Model a yes/no outcome. See why a straight line fails, wrap it in the inverse logit, search for the parameters with optim(), then fit the same model with logistic_reg(). Read the step-by-step guide.
Exercise: The Challenger Launch Turn in
Model O-ring damage against launch temperature with your AI assistant. Push it with the submit prompt, and turn in the link.
Multiple Regression
Lecture
Put more than one predictor in a model. Add curves for age and education, plot the predictions, and find the average marginal effect of education. Read the step-by-step guide.
Exercise: Doctor Who on Holidays Turn in
Do holiday episodes get more viewers? Find out with your AI assistant. Push it with the submit prompt, and turn in the link.
Random Forests
Lecture
Draw the decision boundary of a model. See why logistic regression draws a straight line, then fit a decision tree and a random forest that can follow other shapes. Install ranger and rpart.plot with pixi. Read the step-by-step guide.
Exercise: EDM or Rap? Turn in
Can a model tell an EDM song from a rap song by its tempo? Find out with your AI assistant. Push it with the submit prompt, and turn in the link.
Dengue Forecasting
Lecture
Forecast weekly dengue cases in two cities with a random forest. Add lag features and see which ones matter most. Install vip with pixi and upload the data from Canvas. Read the step-by-step guide.
Exercise: Dengue Forecasting Turn in
Does last week’s weather help predict this week’s cases? Find out with your AI assistant. Push it with the submit prompt, and turn in the link.
Penguin Forest
Lecture
Predict penguin bill length with a random forest, and see which features matter most. Copy the notebooks into your fork with a prompt and install palmerpenguins with pixi. Read the step-by-step guide.
Exercise: Hotel Bookings Turn in
Which hotel stays include children? Fit a decision tree and a random forest with your AI assistant. Push it with the submit prompt, and turn in the link.
Neural Networks
Lecture
See that a neural network is many small logistic regressions added up. Add more nodes and watch the model bend, then overfit. Install nnet with pixi. Read the step-by-step guide.
Exercise: How Many Nodes? Turn in
Can a neural network tell EDM from rap? Do more nodes help? Find out with your AI assistant. Push it with the submit prompt, and turn in the link.
Encoders
Lecture
Use a trained neural network to turn photos into rows of numbers. Then fit a regular model on that table. Install embed and glmnet with pixi. Read the step-by-step guide.
Exercise: Find Malaria Turn in
Can an encoder tell infected blood cells from healthy ones? Plot the cells with UMAP and fit a model with your AI assistant. Push it with the submit prompt, and turn in the link.
CLIP
Lecture
Look inside CLIP, an encoder that turns photos and sentences into numbers. Then use it to encode blood cell photos. Step through two marimo notebooks in molab. Read the step-by-step guide.
Exercise: Name the Blood Cell Turn in
Can a model name 8 types of blood cell from CLIP embeddings? Plot them with UMAP and fit a random forest with your AI assistant. Push it with the submit prompt, and turn in the link.
marimo
Lecture
A short, fun look at marimo, a notebook tool for Python. Set up your Codespace to run it, then try it with me in class. Read the step-by-step guide.
AI Interpretability
Lecture
Look inside a neural network. See how it packs many ideas into a few neurons, then pull them apart with a sparse autoencoder. Step through two marimo notebooks in molab. Read the step-by-step guide.
Exercise: Did the SAE Find the True Features?
The SAE never saw the answer key. Peek at it and check whether the SAE found the 5 true features.


