Machine learning with wildfire data
Use the familiar DANL 320 explanations, slide sequence, and R workflow with the wildfire PM2.5 data from Classwork 8. Begin with training and test data, overfitting, dummy variables, and residual plots.
This week
Training and test data
- Distinguish modeling for explanation from modeling for prediction.
- Use random numbers to split a data.frame into training and test sets.
- Recognize overfitting by comparing training and test performance.
Dummy variables
- Represent categorical predictors with factors and dummy variables.
- Choose a reference category and avoid the dummy-variable trap.
- Interpret the month coefficients relative to January.
Wildfire example
- Predict total monthly monitor PM2.5 using smoke-plume and weather inputs.
- Fit linear regression and make predictions on the test data.
- Interpret coefficients and inspect residual plots.
Lecture slides
Classwork
Classwork 8: Linear Regression with Wildfire Smoke Data
Follow the DANL 320 linear-regression exercise with the wildfire file: describe the variables, split the data, fit a model with month and county dummies, predict PM2.5, interpret coefficients, and inspect residuals. The same prepared variables and 80/20 split are used in the next three classworks.
The machine-learning sequence
The source page numbers below count the original DANL 320 title slide as page 1. The source concepts and sequence stay the same, with wildfire data replacing the original worked examples.
| Class | Date | Lecture and source slides | Classwork |
|---|---|---|---|
| 1 | Mon · Nov 23 | Lecture 10: DANL 320 lec-02, p25–31 and p47–63 | Classwork 8: linear regression and dummy variables |
| — | Wed · Nov 25 | Thanksgiving Break; no class | |
| 2 | Mon · Nov 30 | Lecture 11: DANL 320 lec-04, p1–28 | Classwork 9: cross-validation, lasso, ridge, and elastic net |
| 3 | Wed · Dec 2 | Lecture 12: DANL 320 lec-05 | Classwork 10: decision trees and pruning |
| 4 | Mon · Dec 7 | Lecture 13: DANL 320 lec-06 | Classwork 11: random forests and gradient-boosted trees |
Data
All four classworks use wildfire_ml_pm25_county_month_2011_2024.csv and its codebook.
The outcome is total PM2.5 at county monitors, rather than wildfire-attributable PM2.5 alone. The random split follows DANL 320 and measures prediction for held-out historical county-months using observed monthly inputs. Forecasting a future year would require a different split and an input-timing check.
Before November 30
Bring the prepared wildfire table, the dtrain and dtest split, your linear regression model, and its test predictions. Be ready to interpret a month coefficient and explain what the test RMSE measures.