Something went wrong. Try again.
[mirror] R Package for a Mildly Opinionated Stan Bayesian Workflow stanflow.visruth.com
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081library(touchstone)
# GHA has already resolved dependency versions. Do not let Touchstone upgrade them.local({ ns <- asNamespace("touchstone") unlockBinding("install_missing_deps", ns) assign( "install_missing_deps", function(path_pkg, quiet = FALSE) { remotes::install_deps(pkgdir = path_pkg, upgrade = "never", quiet = quiet) }, envir = ns ) lockBinding("install_missing_deps", ns)})
# Install both branches to benchmarkbranch_install()
# Clone pinned repositories for benchmarkingbase_dir <- file.path("touchstone", "sources")dir.create(base_dir, recursive = TRUE, showWarnings = FALSE)
n <- 30repos <- list( list( url = "https://github.com/tidyverse/ggplot2.git", ref = "v4.0.2" ), list( url = "https://github.com/ASKurz/Statistical_Rethinking_with_brms_ggplot2_and_the_tidyverse.git", ref = "1.4.0" ), list( url = "https://github.com/stan-dev/loo.git", ref = "v2.9.0" ))
clone_repo <- function(url, ref, dir) { repo_path <- file.path(base_dir, dir) if (!dir.exists(repo_path)) { message("Cloning ", dir, " at ", ref) system2("git", c("clone", "--depth", "1", "--branch", ref, url, repo_path)) }}
for (repo in repos) { dir <- sub("\\.git$", "", basename(repo$url)) repo_path <- file.path(base_dir, dir) clone_repo(repo$url, repo$ref, dir) benchmark_run( expr_before_benchmark = { library(stanflow) }, n = n, !!dir := stan_cite( path = !!repo_path, strict = FALSE, quiet = TRUE ) )}
loo_path <- file.path(base_dir, "loo")benchmark_run( expr_before_benchmark = { library(stanflow) }, n = n, loo_knitr := stan_cite( path = !!loo_path, strict = FALSE, quiet = TRUE, use_knitr = TRUE ))
# Analyze and report the resultsbenchmark_analyze()