Skip to content

Commit 0289b94

Browse files
authored
RC 1.4.0 (#1313)
* doc updates * verison bumps * updated tsv * more doc updates * update parsnip add-in code and db * added ORCID * keras install in CI * skip to next version
1 parent 9fbeb85 commit 0289b94

19 files changed

+152
-88
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,10 @@ jobs:
6767
with:
6868
python-version: 3.11
6969

70-
- name: Install TensorFlow
70+
- name: Install TensorFlow/Keras
7171
run: |
72-
reticulate::virtualenv_create('r-reticulate', python='3.11')
73-
reticulate::use_virtualenv('r-reticulate')
74-
tensorflow::install_tensorflow(version='2.16')
72+
install.packages(c("keras3"))
73+
keras3::install_keras()
7574
shell: Rscript {0}
7675

7776
- uses: r-lib/actions/check-r-package@v2

.github/workflows/test-coverage.yaml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,10 @@ jobs:
2727
extra-packages: any::covr, any::xml2
2828
needs: coverage
2929

30-
- name: Install dev reticulate
31-
run: pak::pkg_install('rstudio/reticulate')
32-
shell: Rscript {0}
33-
34-
- name: Install Miniconda
35-
run: |
36-
reticulate::install_miniconda()
37-
shell: Rscript {0}
38-
39-
- name: Install TensorFlow
30+
- name: Install TensorFlow/Keras
4031
run: |
41-
reticulate::conda_create('r-reticulate', packages = c('python==3.11'))
42-
tensorflow::install_tensorflow(version='2.16')
32+
install.packages(c("keras3"))
33+
keras3::install_keras()
4334
shell: Rscript {0}
4435

4536
- name: Test coverage

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
Package: parsnip
22
Title: A Common API to Modeling and Analysis Functions
3-
Version: 1.3.3.9001
3+
Version: 1.4.0
44
Authors@R: c(
5-
person("Max", "Kuhn", , "[email protected]", role = c("aut", "cre")),
5+
person("Max", "Kuhn", , "[email protected]", role = c("cre", "aut"),
6+
comment = c(ORCID = "0000-0003-2402-136X")),
67
person("Davis", "Vaughan", , "[email protected]", role = "aut"),
78
person("Emil", "Hvitfeldt", , "[email protected]", role = "ctb"),
89
person("Posit Software, PBC", role = c("cph", "fnd"),

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# parsnip (development version)
1+
# parsnip 1.4.0
22

33
* Fixes issue with running predictions for Decision Trees in Spark (#1309)
44

data/model_db.rda

557 Bytes
Binary file not shown.

inst/add-in/parsnip_model_db.R

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,66 @@ library(usethis)
99
# also requires installation of:
1010
packages <- c(
1111
"parsnip",
12-
"discrim",
13-
"plsmod",
14-
"rules",
15-
"baguette",
16-
"poissonreg",
17-
"multilevelmod",
18-
"modeltime",
19-
"modeltime.gluonts"
12+
parsnip:::extensions(),
13+
"modeltime"
14+
# "modeltime.gluonts" # required python packages to create spec
2015
)
2116

17+
loaded <- map(packages, library, character.only = TRUE)
18+
2219
# ------------------------------------------------------------------------------
2320

24-
# Detects model specifications via their print methods
25-
print_methods <- function(x) {
26-
require(x, character.only = TRUE)
27-
ns <- asNamespace(ns = x)
28-
mthds <- ls(envir = ns, pattern = "^print\\.")
29-
mthds <- gsub("^print\\.", "", mthds)
30-
purrr::map(mthds, get_engines) |>
21+
get_model <- function(x) {
22+
res <- get_from_env(x)
23+
if (!is.null(res)) {
24+
res <- dplyr::mutate(res, model = x)
25+
}
26+
res
27+
}
28+
29+
get_packages <- function(x) {
30+
res <- get_from_env(paste0(x, "_pkgs"))
31+
if (is.null(res)) {
32+
return(res)
33+
}
34+
res <-
35+
res |>
36+
tidyr::unnest(pkg) |>
37+
dplyr::mutate(
38+
model = x
39+
)
40+
41+
res
42+
}
43+
44+
get_models <- function() {
45+
res <- ls(envir = get_model_env(), pattern = "_fit$")
46+
models <- gsub("_fit$", "", res)
47+
models <-
48+
purrr::map(models, get_model) |>
49+
purrr::list_rbind()
50+
51+
# get source package
52+
pkgs <- gsub("_fit$", "_pkgs", res)
53+
pkgs <-
54+
unique(models$model) |>
55+
purrr::map(get_packages) |>
3156
purrr::list_rbind() |>
32-
dplyr::mutate(package = x)
57+
dplyr::filter(pkg %in% packages)
58+
dplyr::left_join(models, pkgs, by = dplyr::join_by(engine, mode, model)) |>
59+
dplyr::rename(package = pkg) |>
60+
dplyr::mutate(
61+
package = dplyr::if_else(is.na(package), "parsnip", package),
62+
call_from_parsnip = package %in% parsnip:::extensions(),
63+
caller_package = dplyr::if_else(
64+
call_from_parsnip,
65+
"parsnip",
66+
package
67+
)
68+
)
3369
}
70+
71+
3472
get_engines <- function(x) {
3573
eng <- try(parsnip::show_engines(x), silent = TRUE)
3674
if (inherits(eng, "try-error")) {
@@ -77,8 +115,8 @@ get_tunable_param <- function(mode, package, model, engine) {
77115
# ------------------------------------------------------------------------------
78116

79117
model_db <-
80-
purrr::map(packages, print_methods) |>
81-
purrr::list_rbind() |>
118+
get_models() |>
119+
dplyr::filter(mode %in% c("regression", "classification")) |>
82120
dplyr::filter(engine != "liquidSVM") |>
83121
dplyr::filter(model != "surv_reg") |>
84122
dplyr::filter(engine != "spark") |>
@@ -98,9 +136,10 @@ model_db <-
98136
dplyr::left_join(model_db, num_modes, by = c("package", "model", "engine")) |>
99137
dplyr::mutate(
100138
parameters = purrr::pmap(
101-
list(mode, package, model, engine),
139+
list(mode, caller_package, model, engine),
102140
get_tunable_param
103141
)
104-
)
142+
) |>
143+
dplyr::select(-call_from_parsnip, -caller_package)
105144

106145
usethis::use_data(model_db, overwrite = TRUE)

inst/models.tsv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
"bart" "regression" "dbarts" NA
1515
"boost_tree" "censored regression" "mboost" "censored"
1616
"boost_tree" "classification" "C5.0" NA
17+
"boost_tree" "classification" "catboost" "bonsai"
1718
"boost_tree" "classification" "h2o" "agua"
1819
"boost_tree" "classification" "h2o_gbm" "agua"
1920
"boost_tree" "classification" "lightgbm" "bonsai"
2021
"boost_tree" "classification" "spark" NA
2122
"boost_tree" "classification" "xgboost" NA
23+
"boost_tree" "regression" "catboost" "bonsai"
2224
"boost_tree" "regression" "h2o" "agua"
2325
"boost_tree" "regression" "h2o_gbm" "agua"
2426
"boost_tree" "regression" "lightgbm" "bonsai"

man/details_bart_dbarts.Rd

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/details_boost_tree_h2o.Rd

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/details_boost_tree_xgboost.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)