tidymodels / recipes

Pipeable steps for feature engineering and data preprocessing to prepare for modeling
https://recipes.tidymodels.org
Other
564 stars 111 forks source link

Uninformative print message for unprepped step_pca() #845

Closed EmilHvitfeldt closed 2 years ago

EmilHvitfeldt commented 2 years ago

Ideally, this should print to #> PCA extraction with all_numeric() instead of #> No PCA components were extracted. All steps should be investigated before this issue is closed. I haven't looked at other steps than step_pca()

library(recipes)

recipe(mpg ~ ., data = mtcars) %>%
  step_pca(all_numeric(), num_comp = 3)
#> Recipe
#> 
#> Inputs:
#> 
#>       role #variables
#>    outcome          1
#>  predictor         10
#> 
#> Operations:
#> 
#> No PCA components were extracted.

recipe(mpg ~ ., data = mtcars) %>%
  step_pca(all_numeric(), num_comp = 3) %>%
  prep()
#> Recipe
#> 
#> Inputs:
#> 
#>       role #variables
#>    outcome          1
#>  predictor         10
#> 
#> Training data contained 32 data points and no missing data.
#> 
#> Operations:
#> 
#> PCA extraction with cyl, disp, hp, drat, wt, qsec, vs, am, gear, car... [trained]

recipe(mpg ~ ., data = mtcars) %>%
  step_kpca(all_numeric(), num_comp = 3)
#> Recipe
#> 
#> Inputs:
#> 
#>       role #variables
#>    outcome          1
#>  predictor         10
#> 
#> Operations:
#> 
#> Kernel PCA extraction with all_numeric()

recipe(mpg ~ ., data = mtcars) %>%
  step_kpca(all_numeric(), num_comp = 3) %>%
  prep()
#> Recipe
#> 
#> Inputs:
#> 
#>       role #variables
#>    outcome          1
#>  predictor         10
#> 
#> Training data contained 32 data points and no missing data.
#> 
#> Operations:
#> 
#> Kernel PCA (rbfdot) extraction with cyl, disp, hp, drat, wt, qsec, vs, am... [trained]
github-actions[bot] commented 2 years ago

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.