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

Unnecessary pattern in 3.8.3 #70

Open
guidothekp opened this issue Apr 10, 2023 · 0 comments
Open

Unnecessary pattern in 3.8.3 #70

guidothekp opened this issue Apr 10, 2023 · 0 comments

Comments

@guidothekp
Copy link

In section 3.8.3 an example is shown on how to put the process together. The following is the snippet of code:

blueprint <- recipe(Sale_Price ~ ., data = ames_train) %>%
  step_nzv(all_nominal())  %>%
  step_integer(matches("Qual|Cond|QC|Qu")) %>%
  step_center(all_numeric(), -all_outcomes()) %>%
  step_scale(all_numeric(), -all_outcomes()) %>%
  step_pca(all_numeric(), -all_outcomes())

In the step, step_integer(matches("Qual|Cond|QC|Qu")) the pattern Qual is unnecessary as it is already covered by Qu. We can verify this:

> ames_train %>% select(matches("Qual")) %>% names
[1] "Overall_Qual"    "Exter_Qual"      "Bsmt_Qual"       "Low_Qual_Fin_SF"
[5] "Kitchen_Qual"    "Garage_Qual"    
> ames_train %>% select(matches("Qu")) %>% names
[1] "Overall_Qual"    "Exter_Qual"      "Bsmt_Qual"       "Low_Qual_Fin_SF"
[5] "Kitchen_Qual"    "Fireplace_Qu"    "Garage_Qual"    
> ames_train %>% select(matches("Qual|Qu")) %>% names
[1] "Overall_Qual"    "Exter_Qual"      "Bsmt_Qual"       "Low_Qual_Fin_SF"
[5] "Kitchen_Qual"    "Fireplace_Qu"    "Garage_Qual"  

The pattern Qu includes Qual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant