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

Error: 'train_catboost' is not an exported object from 'namespace:treesnip #68

Open
angelhsu05 opened this issue Aug 3, 2022 · 1 comment

Comments

@angelhsu05
Copy link

angelhsu05 commented Aug 3, 2022

I'm trying to conduct a grid search per https://www.r-bloggers.com/2020/08/how-to-use-catboost-with-tidymodels/, but when I try, following this example, i'm getting an error where all models fail and it says "train_catboost" is not an exported object from 'namespace:treesnip'

@vidarvr
Copy link

vidarvr commented Oct 13, 2023

For anyone having similar problems there are two solutions that worked for me, both on windows and linux (docker).

When running sequentially it's should be sufficienet to add this to my code:

parsnip::set_dependency("boost_tree", eng = "catboost", pkg = "catboost", mode = "regression")
parsnip::set_dependency("boost_tree", eng = "catboost", pkg = "treesnip", mode = "regression")

However, when I tune the hyperparameters (grid search or a race method) and use parallel processing I still get an error.

This is what worked for me:

    cl <- parallel::makeCluster(n_cores)

    result <- parallel::clusterEvalQ(cl, {
      sink(file=NULL)
      library(tidymodels)
      library(catboost)
      library(treesnip)
      sink()
    })

    doParallel::registerDoParallel(cl)

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

2 participants