Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RC 1.1.3 #209

Merged
merged 7 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: embed
Title: Extra Recipes for Encoding Predictors
Version: 1.1.2.9000
Version: 1.1.3.9000
Authors@R: c(
person("Emil", "Hvitfeldt", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-0679-1945")),
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ S3method(tunable,step_woe)
export(add_woe)
export(dictionary)
export(embed_control)
export(is_tf_available)
export(required_pkgs)
export(step_collapse_cart)
export(step_collapse_stringdist)
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# embed (development version)

* `step_collapse_stringdist()` will now return predictors as factors.
# embed 1.1.3

* `step_collapse_stringdist()` will now return predictors as factors. (#204)

* Fixed regression from 1.1.2 in `step_lencode_glm()` where it couldn't be used on multiple columns.

# embed 1.1.2

Expand Down
9 changes: 9 additions & 0 deletions R/aaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@ utils::globalVariables(
)
)

# adapted from ps:::is_cran_check()
is_cran_check <- function() {
if (identical(Sys.getenv("NOT_CRAN"), "true")) {
FALSE
}
else {
Sys.getenv("_R_CHECK_PACKAGE_NAME_", "") != ""
}
}
# nocov end
8 changes: 1 addition & 7 deletions R/embed.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
#' "Concatenate Embeddings for Categorical Variables with Keras"
#' \url{https://flovv.github.io/Embeddings_with_keras_part2/}
#'
#' @examplesIf is_tf_available() && rlang::is_installed("modeldata")
#' @examplesIf !embed:::is_cran_check() && rlang::is_installed("modeldata")
#' data(grants, package = "modeldata")
#'
#' set.seed(1)
Expand Down Expand Up @@ -531,12 +531,6 @@ class2ind <- function(x) {
y
}

#' Test to see if tensorflow is available
#'
#' @return A logical
#' @examples
#' is_tf_available()
#' @export
is_tf_available <- function() {
if (!rlang::is_installed("tensorflow")) {
return(FALSE)
Expand Down
2 changes: 1 addition & 1 deletion R/feature_hash.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#' Approach for Predictive Models_. CRC/Chapman Hall
#' \url{https://bookdown.org/max/FES/encoding-predictors-with-many-categories.html}
#' @seealso [recipes::step_dummy()], [recipes::step_zv()]
#' @examplesIf is_tf_available() && rlang::is_installed("modeldata")
#' @examplesIf !embed:::is_cran_check() && rlang::is_installed("modeldata")
#' data(grants, package = "modeldata")
#' rec <-
#' recipe(class ~ sponsor_code, data = grants_other) %>%
Expand Down
2 changes: 1 addition & 1 deletion R/lencode_glm.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ bake.step_lencode_glm <- function(object, new_data, ...) {
for (col_name in col_names) {
new_data[[col_name]] <- map_glm_coef(
dat = new_data[, col_name], # map_glm_coef() expects a tibble
mapping = object$mapping[[col_names]]
mapping = object$mapping[[col_name]]
)
}

Expand Down
1 change: 0 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ reference:
- title: miscellaneous
contents:
- dictionary
- is_tf_available
- title: Tidy Methods
contents:
- tidy.recipe
Expand Down
17 changes: 0 additions & 17 deletions man/is_tf_available.Rd

This file was deleted.

2 changes: 1 addition & 1 deletion man/step_embed.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/step_feature_hash.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 27 additions & 28 deletions revdep/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
# Platform

|field |value |
|:--------|:------------------------------------------------------------------------------------------|
|version |R version 4.3.0 (2023-04-21) |
|os |macOS Ventura 13.5 |
|system |aarch64, darwin20 |
|ui |RStudio |
|language |(EN) |
|collate |en_US.UTF-8 |
|ctype |en_US.UTF-8 |
|tz |America/Los_Angeles |
|date |2023-08-14 |
|rstudio |2023.09.0-daily+310 Desert Sunflower (desktop) |
|pandoc |3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown) |
|field |value |
|:--------|:------------------------------------------------------------|
|version |R version 4.3.1 (2023-06-16) |
|os |macOS Ventura 13.6 |
|system |aarch64, darwin20 |
|ui |X11 |
|language |(EN) |
|collate |en_US.UTF-8 |
|ctype |en_US.UTF-8 |
|tz |America/Los_Angeles |
|date |2023-10-17 |
|pandoc |3.1.3 @ /Users/emilhvitfeldt/miniforge3/bin/ (via rmarkdown) |

# Dependencies

|package |old |new |Δ |
|:------------|:----------|:----------|:--|
|embed |1.1.1 |1.1.1.9000 |* |
|embed |1.1.2 |1.1.2.9000 |* |
|backports |1.4.1 |1.4.1 | |
|base64enc |0.1-3 |0.1-3 | |
|BH |1.81.0-1 |1.81.0-1 | |
|cli |3.6.1 |3.6.1 | |
|clock |0.7.0 |0.7.0 | |
|config |0.3.1 |0.3.1 | |
|config |0.3.2 |0.3.2 | |
|cpp11 |0.4.6 |0.4.6 | |
|data.table |1.14.8 |1.14.8 | |
|diagram |1.6.5 |1.6.5 | |
|digest |0.6.33 |0.6.33 | |
|dplyr |1.1.2 |1.1.2 | |
|dqrng |0.3.0 |0.3.0 | |
|dplyr |1.1.3 |1.1.3 | |
|dqrng |0.3.1 |0.3.1 | |
|ellipsis |0.3.2 |0.3.2 | |
|fansi |1.0.4 |1.0.4 | |
|fansi |1.0.5 |1.0.5 | |
|FNN |1.1.3.2 |1.1.3.2 | |
|furrr |0.3.1 |0.3.1 | |
|future |1.33.0 |1.33.0 | |
Expand All @@ -46,19 +45,19 @@
|ipred |0.9-14 |0.9-14 | |
|irlba |2.3.5.1 |2.3.5.1 | |
|jsonlite |1.8.7 |1.8.7 | |
|keras |2.11.1 |2.11.1 | |
|keras |2.13.0 |2.13.0 | |
|lava |1.7.2.1 |1.7.2.1 | |
|lifecycle |1.0.3 |1.0.3 | |
|listenv |0.9.0 |0.9.0 | |
|lubridate |1.9.2 |1.9.2 | |
|lubridate |1.9.3 |1.9.3 | |
|magrittr |2.0.3 |2.0.3 | |
|numDeriv |2016.8-1.1 |2016.8-1.1 | |
|parallelly |1.36.0 |1.36.0 | |
|pillar |1.9.0 |1.9.0 | |
|pkgconfig |2.0.3 |2.0.3 | |
|png |0.1-8 |0.1-8 | |
|processx |3.8.2 |3.8.2 | |
|prodlim |2023.03.31 |2023.03.31 | |
|prodlim |2023.08.28 |2023.08.28 | |
|progressr |0.14.0 |0.14.0 | |
|ps |1.7.5 |1.7.5 | |
|purrr |1.0.2 |1.0.2 | |
Expand All @@ -68,19 +67,19 @@
|RcppAnnoy |0.0.21 |0.0.21 | |
|RcppProgress |0.4.2 |0.4.2 | |
|RcppTOML |0.2.2 |0.2.2 | |
|recipes |1.0.7 |1.0.7 | |
|reticulate |1.31 |1.31 | |
|recipes |1.0.8 |1.0.8 | |
|reticulate |1.34.0 |1.34.0 | |
|rlang |1.1.1 |1.1.1 | |
|rprojroot |2.0.3 |2.0.3 | |
|rsample |1.1.1 |1.1.1 | |
|rsample |1.2.0 |1.2.0 | |
|rstudioapi |0.15.0 |0.15.0 | |
|shape |1.4.6 |1.4.6 | |
|sitmo |2.0.2 |2.0.2 | |
|slider |0.3.0 |0.3.0 | |
|slider |0.3.1 |0.3.1 | |
|SQUAREM |2021.1 |2021.1 | |
|stringi |1.7.12 |1.7.12 | |
|stringr |1.5.0 |1.5.0 | |
|tensorflow |2.11.0 |2.11.0 | |
|tensorflow |2.14.0 |2.14.0 | |
|tfautograph |0.3.2 |0.3.2 | |
|tfruns |1.5.1 |1.5.1 | |
|tibble |3.2.1 |3.2.1 | |
Expand All @@ -91,10 +90,10 @@
|tzdb |0.4.0 |0.4.0 | |
|utf8 |1.2.3 |1.2.3 | |
|uwot |0.1.16 |0.1.16 | |
|vctrs |0.6.3 |0.6.3 | |
|vctrs |0.6.4 |0.6.4 | |
|warp |0.2.0 |0.2.0 | |
|whisker |0.4.1 |0.4.1 | |
|withr |2.5.0 |2.5.0 | |
|withr |2.5.1 |2.5.1 | |
|yaml |2.3.7 |2.3.7 | |
|zeallot |0.1.0 |0.1.0 | |

Expand Down
22 changes: 11 additions & 11 deletions tests/testthat/test-embed.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ withr::local_envvar(TF_CPP_MIN_LOG_LEVEL = "2")

test_that("factor encoded predictor", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())

class_test <- recipe(x2 ~ ., data = ex_dat) %>%
step_embed(x3, outcome = vars(x2), options = embed_control(verbose = 0), id = "id") %>%
Expand Down Expand Up @@ -80,7 +80,7 @@ test_that("factor encoded predictor", {

test_that("character encoded predictor", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())

class_test <- recipe(x2 ~ ., data = ex_dat_ch) %>%
step_embed(x3, outcome = vars(x2), options = embed_control(verbose = 0)) %>%
Expand Down Expand Up @@ -148,7 +148,7 @@ test_that("character encoded predictor", {

test_that("factor encoded predictor", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())

class_test <- recipe(x1 ~ ., data = ex_dat) %>%
step_embed(x3, outcome = vars(x1), options = embed_control(verbose = 0)) %>%
Expand Down Expand Up @@ -217,7 +217,7 @@ test_that("factor encoded predictor", {

test_that("character encoded predictor", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())

class_test <- recipe(x1 ~ ., data = ex_dat_ch) %>%
step_embed(x3, outcome = vars(x1), num_terms = 5, options = embed_control(verbose = 0)) %>%
Expand Down Expand Up @@ -285,7 +285,7 @@ test_that("character encoded predictor", {

test_that("bad args", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())

three_class <- iris
three_class$fac <- rep(letters[1:3], 50)
Expand All @@ -301,7 +301,7 @@ test_that("bad args", {

test_that("check_name() is used", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())

dat <- ex_dat
dat$x3_embed_1 <- dat$x3
Expand Down Expand Up @@ -334,7 +334,7 @@ test_that("tunable", {

test_that("bake method errors when needed non-standard role columns are missing", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())
rec <- recipe(x2 ~ ., data = ex_dat) %>%
step_embed(
x3,
Expand All @@ -355,7 +355,7 @@ test_that("bake method errors when needed non-standard role columns are missing"

test_that("empty printing", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())

rec <- recipe(mpg ~ ., mtcars)
rec <- step_embed(rec, outcome = vars(mpg))
Expand Down Expand Up @@ -400,7 +400,7 @@ test_that("empty selection tidy method works", {

test_that("keep_original_cols works", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())

new_names <- c("x2", "x3_embed_1", "x3_embed_2")

Expand Down Expand Up @@ -431,7 +431,7 @@ test_that("keep_original_cols works", {

test_that("keep_original_cols - can prep recipes with it missing", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())

rec <- recipe(x2 ~ x3, data = ex_dat) %>%
step_embed(x3, outcome = vars(x2), options = embed_control(verbose = 0))
Expand All @@ -450,7 +450,7 @@ test_that("keep_original_cols - can prep recipes with it missing", {

test_that("printing", {
skip_on_cran()
skip_if(!is_tf_available())
skip_if(!embed:::is_tf_available())

rec <- recipe(x2 ~ ., data = ex_dat_ch) %>%
step_embed(x3, outcome = vars(x2))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ library(embed)
library(dplyr)
library(testthat)

is_tf_available()
embed:::is_tf_available()
Loading