Skip to content

Add argument for one hot encoding to workflows #53

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

Merged
merged 22 commits into from
Jul 1, 2020

Conversation

juliasilge
Copy link
Member

This PR integrates the one_hot argument from tidymodels/parsnip#332 and tidymodels/hardhat#140 into workflows. After all this work, finally, FINALLY, the weirdness demonstrated in tidymodels/parsnip#326 is resolved:

library(parsnip)
library(workflows)

lm_spec <- linear_reg() %>%
  set_engine(engine = "lm") 

lm_spec %>%
  fit(Sepal.Length ~ ., data = iris)
#> parsnip model object
#> 
#> Fit time:  5ms 
#> 
#> Call:
#> stats::lm(formula = Sepal.Length ~ ., data = data)
#> 
#> Coefficients:
#>       (Intercept)        Sepal.Width       Petal.Length        Petal.Width  
#>            2.1713             0.4959             0.8292            -0.3152  
#> Speciesversicolor   Speciesvirginica  
#>           -0.7236            -1.0235

workflow() %>%
  add_model(lm_spec) %>%
  add_formula(Sepal.Length ~ .) %>%
  fit(data = iris)
#> ══ Workflow [trained] ══════════════════════════════════════════════════
#> Preprocessor: Formula
#> Model: linear_reg()
#> 
#> ── Preprocessor ────────────────────────────────────────────────────────
#> Sepal.Length ~ .
#> 
#> ── Model ───────────────────────────────────────────────────────────────
#> 
#> Call:
#> stats::lm(formula = ..y ~ ., data = data)
#> 
#> Coefficients:
#>       (Intercept)        Sepal.Width       Petal.Length        Petal.Width  
#>            2.1713             0.4959             0.8292            -0.3152  
#> Speciesversicolor   Speciesvirginica  
#>           -0.7236            -1.0235

Created on 2020-06-23 by the reprex package (v0.3.0.9001)

🙌

@juliasilge
Copy link
Member Author

I just set DESCRIPTION to use development versions of parsnip + hardhat, but neither of those PRs are merged as of right now.

@juliasilge
Copy link
Member Author

It will be super important to redocument after merging this because of the material in man/rmd/indicators.Rmd, which currently has conflicting info (5 vs. 6 predictors) due to the one hot issue.

@github-actions
Copy link

github-actions bot commented Mar 6, 2021

This pull request 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.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants