Model results for the forested classification example in Applied Machine Learning for Tabular Data. The book loads the files in results/ at a pinned commit of this repo; it doesn't fit these models itself.
| Path | Contents |
|---|---|
R/forested_data.R |
Data split and spatial resamples → processed-data/forested_data.RData (needs CENSUS_API_KEY) |
R/forested_plot_sf.R |
Small spatial example for plots → processed-data/forested_plot_sf.RData |
R/setup.R |
Sourced by every script: packages, data, metrics, save_results() |
R/compare-<key>.R |
Model comparisons (tidyposterior) → results/forested_<key>_results.RData and forested_<key>_compare.RData |
R/recipes-linear.R |
Recipes shared by the logistic, glmnet, and PLS scripts |
R/model-<key>.R |
One model each → results/forested_<key>_res.RData (or _res_set) |
R/demo-<key>.R |
Non-model outputs used in the book → results/forested_<key>.RData |
R/qc_names.R |
Naming and file-size checks |
processed-data/ |
Data used by all scripts |
results/ |
Committed results, plus each script's .Rout log |
timings.log |
Run times appended by make |
rproj.toml, rproj.lock, .Renviron, .rvenvlib/ |
rig project: dependencies, pinned versions, library setup |
Naming rules, the script template, and how to add a model are in CONVENTIONS.md.
Install rig 0.11.1 or later following rig's install instructions (macOS, Linux). On macOS with Homebrew, that's brew install r-rig. Then install the R version in rproj.toml (currently 4.6), e.g. rig add 4.6.2.
If rig --version shows an older version, there's probably a second copy earlier on your PATH; check with which -a rig, remove the old one, and open a new terminal.
To uninstall rig:
- Homebrew:
brew uninstall r-rig. - Install script (
install.sh):rig self uninstall --force(docs). - Older macOS installer (
.pkg):sudo rm /usr/local/bin/rigandsudo pkgutil --forget com.gaborcsardi.rig.
Uninstalling rig doesn't remove the R versions it installed (rig rm <version>) or its cache (rig cache clean).
R and packages are managed with rig (0.11.1 or later) as a project: rproj.toml lists the dependencies and rproj.lock pins every version, including the GitHub branches (by commit). Set up the project library in .rvenv/ with:
make env # rig proj sync, catboost (macOS), libtorchThe committed .Renviron points R at that library, so make, R, Rscript, and IDEs started at the repo root all use it (R --vanilla doesn't).
- catboost isn't on CRAN.
make envinstalls its macOS binary from the GitHub release (pinned by URL and SHA-256 in theMakefile) withR CMD INSTALL --no-staged-install, since the binary fails R's staged-install check and rig can't pass that option. On Linux (e.g. a GPU machine for the deep learning models) it's skipped, so everything exceptR/model-ctb.Rruns there. - Census key:
make dataneedsCENSUS_API_KEYwhich can be obtained at https://api.census.gov/data/key_signup.html. Put it in the gitignored.Renviron.local(or the shell environment), not in.Renviron.
rig reads dependencies only from rproj.toml; it doesn't scan the scripts. Add a package with rig proj add, which updates rproj.toml and rproj.lock and installs it:
rig proj add kernlab # CRAN (or Bioconductor)
rig proj add tidymodels/tabby@brulee-pfn # GitHub branch, tag, or commit
rig proj remove kernlab- Add packages that are only suggested by others but needed at run time (e.g.
lme4andsplines2for some recipe steps); rig won't pick them up. - A GitHub package's
Remotes:field wins over a CRAN version inrproj.toml, so checkrproj.lockfor unexpectedgit+sources. - Use
rig proj add --no-sync, thenmake env. Without--no-sync,rig proj addsyncs the library and removes catboost (it isn't in the lock file);make envputs it back.--no-syncalso keeps from changing the library whilemakeis running.
Commit rproj.toml and rproj.lock together.
rproj.lock keeps every version it has pinned until asked to change. GitHub branches are pinned to the commit they were at when added, so new commits on the branch aren't picked up automatically.
rig proj lock -P tabby -P rbe # re-resolve some packages (new branch commits, newer CRAN versions)
rig proj lock --upgrade # re-resolve everything
make env # install what changedResults made before an update used the old versions; rerun the affected models if that matters.
To change the R version, edit R = ">= ..." and r-versions in rproj.toml, install that R with rig add, then run rig proj lock, rm -rf .rvenv, and make env (a sync alone keeps packages built for the old R).
make help # list targets
make list # keys, scripts, and result files
make trees # one group, full data
make # everything missing or out of date, full data (hours)
make check # naming and size checksScripts run serially from the repo root. make prints a timestamped line when each script starts and finishes, writes the script's .Rout log to results/, and appends the run time to timings.log.