Giter Club home page Giter Club logo

Comments (2)

juliasilge avatar juliasilge commented on June 25, 2024 1

Thanks for reporting this bug so very long ago @tmastny! Since we have moved to using recipes::recipes_eval_select() in embed (or possibly sooner TBH) this problem has been resolved.

library(recipes)
#> Loading required package: dplyr
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
#> 
#> Attaching package: 'recipes'
#> The following object is masked from 'package:stats':
#> 
#>     step
library(embed)

data(PimaIndiansDiabetes, package = "mlbench")

d <- PimaIndiansDiabetes
d <- d %>%
  as_tibble() %>%
  select(diabetes, everything())

# make factor variables
d <- d %>%
  mutate(mass_fct = factor(ifelse(mass > 30, "large", "small"))) %>%
  mutate(pregnant_fct = as.factor(pregnant)) %>%
  mutate(pressure_fct = factor(case_when(
    pressure < 30 ~ "low",
    between(pressure, 30, 50) ~ "medium",
    pressure > 50 ~ "high"
  ))) %>%
  mutate(triceps_fct = factor(ifelse(triceps > 0, "has", "none"))) %>%
  mutate(insulin_fct = factor(insulin)) %>%
  mutate(age_fct = factor(age))

embed_rec <- recipe(diabetes ~ ., d) %>%
  step_woe(mass_fct, outcome = vars(diabetes)) %>%
  step_lencode_glm(pressure_fct, outcome = vars(diabetes))

prep(embed_rec, d)
#> Recipe
#> 
#> Inputs:
#> 
#>       role #variables
#>    outcome          1
#>  predictor         14
#> 
#> Training data contained 768 data points and no missing data.
#> 
#> Operations:
#> 
#> WoE version against outcome structure(list(~diabetes), .Names = "", class = c("quosures", 
#> "list")) for mass_fct [trained]
#> Linear embedding for factors via GLM for pressure_fct [trained]

Created on 2021-11-19 by the reprex package (v2.0.1)

We are aware of the strange printing for step_woe() and are tracking that in #92

from embed.

github-actions avatar github-actions commented on June 25, 2024

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

from embed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.