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

Turn off parallel processing for NMF, do not load pkgs #685

Merged
merged 2 commits into from Apr 15, 2021

Conversation

juliasilge
Copy link
Member

Closes #681

This PR turns off the parallelization that NMF has on by default, which allows us to use NMF and dimRed without fully loading them as before. This solves the problem with fit():

library(tidymodels)
#> Registered S3 method overwritten by 'tune':
#>   method                   from   
#>   required_pkgs.model_spec parsnip
data(biomass)

rec <- recipe(HHV ~ ., data = biomass) %>%
  update_role(sample, new_role = "id var") %>%
  update_role(dataset, new_role = "split variable") %>%
  step_nnmf(all_numeric_predictors(), num_comp = 2, seed = 473, num_run = 2) %>%
  prep(training = biomass)

linear_reg() %>% fit(mpg ~ ., data = mtcars)
#> Warning: Engine set to `lm`.
#> parsnip model object
#> 
#> Fit time:  3ms 
#> 
#> Call:
#> stats::lm(formula = mpg ~ ., data = data)
#> 
#> Coefficients:
#> (Intercept)          cyl         disp           hp         drat           wt  
#>    12.30337     -0.11144      0.01334     -0.02148      0.78711     -3.71530  
#>        qsec           vs           am         gear         carb  
#>     0.82104      0.31776      2.52023      0.65541     -0.19942

Created on 2021-04-14 by the reprex package (v2.0.0)

In the future, we could consider exposing some kind of parallel option for step_nnmf() for folks who use it outside of our tuning infrastructure and want to run it in parallel.

@juliasilge juliasilge requested a review from topepo April 14, 2021 23:30
Copy link
Member

@DavisVaughan DavisVaughan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

@juliasilge juliasilge merged commit 2c10d53 into master Apr 15, 2021
@juliasilge juliasilge deleted the nnmf-no-require branch April 15, 2021 14:57
@github-actions
Copy link

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 Apr 30, 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.

Loading the required packages for step_nnmf() makes fit() misbehave
2 participants