TidyModels 是否提供执行多模型建模的能力?

Does TidyModels provide the capability to perform Many Models modeling?

我最近一直在使用 TidyModels,想知道它是否具有适用于许多模型的功能,类似于 R For Data Science 的“许多模型”一章中介绍的 Modelr 中可用的功能。

我已经查看了文档,但没有看到这个。

tidymodels 框架对 modelr 允许您执行的任务类型提供了更强大和更具表现力的支持,例如创建数据重采样、管道模型等。 package is part of tidymodels with verbs like tidy() and glance() important parts of the tidymodels approach to modeling, and the rsample 包提供重采样工具。

您可能对checking out how to use this kind of approach for bootstrap estimates of model parameters感兴趣:

library(tidymodels)
#> ── Attaching packages ──────────────────────────── tidymodels 0.1.0 ──
#> ✓ broom     0.5.6          ✓ recipes   0.1.12    
#> ✓ dials     0.0.7          ✓ rsample   0.0.7     
#> ✓ dplyr     1.0.0          ✓ tibble    3.0.1     
#> ✓ ggplot2   3.3.1          ✓ tune      0.1.0     
#> ✓ infer     0.5.2          ✓ workflows 0.1.1.9000
#> ✓ parsnip   0.1.1.9000     ✓ yardstick 0.0.6.9000
#> ✓ purrr     0.3.4
#> ── Conflicts ─────────────────────────────── tidymodels_conflicts() ──
#> x purrr::discard() masks scales::discard()
#> x dplyr::filter()  masks stats::filter()
#> x dplyr::lag()     masks stats::lag()
#> x recipes::step()  masks stats::step()
library(tidyr)

set.seed(123)
boots <- bootstraps(mtcars, times = 1000, apparent = TRUE)

fit_spline <- function(split) {
  data <- analysis(split)
  smooth.spline(data$wt, data$mpg, df = 4)
}

boot_models <- boots %>% 
  mutate(spline = map(splits, fit_spline))

boot_models %>% 
  sample_n(200) %>% 
  mutate(aug = map(spline, augment)) %>% 
  unnest(aug) %>%
  ggplot(aes(x, y)) +
  geom_line(aes(y = .fitted, group = id), alpha = .2, col = "darkcyan") +
  geom_point()

reprex package (v0.3.0.9001)

于 2020-06-18 创建

如果您对创建模型参数网格感兴趣,请查看 dials 包。