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 in running the EstimateCate() with X_BART on windows #8

Open
polina-mdrc opened this issue May 4, 2023 · 2 comments
Open

Error in running the EstimateCate() with X_BART on windows #8

polina-mdrc opened this issue May 4, 2023 · 2 comments

Comments

@polina-mdrc
Copy link

When I tried to use the EstimateCate() function on the X_BART() model, I got the error: "Error in BART::mc.wbart(x.train = x.train, y.train = y.train, x.test = x.test, : parallel::mcparallel/mccollect do not exist on windows"
I am running on Windows and the "causalToolbox" version is 0.0.2.4. Are there any solutions to make it work on Windows?
Any advise would be helpful. Thank you!

@victorfeagins
Copy link

Same issue

@victorfeagins
Copy link

victorfeagins commented Jul 13, 2023

I ended up going into the repo and copy and changing get_BART_pred function and then rerunning the X_BART function to get a local copy of the function to not use the package version.

get_BART_pred <- function(x.train, y.train, x.test, ndpost, ntree, 
                          hyperparam) {
  
  pred_matrix <-
    BART::wbart( #### What I change as well as remove the mc.cores = nthread argument
      x.train = x.train,
      y.train = y.train,
      x.test = x.test,
      ndpost = ndpost,
      ntree = ntree,
      sparse =    hyperparam$sparse,
      theta =     hyperparam$theta,
      omega =     hyperparam$omega,
      a =         hyperparam$a,
      b =         hyperparam$b,
      augment =   hyperparam$augment,
      rho =       hyperparam$rho,
      usequants = hyperparam$usequants,
      cont =      hyperparam$cont,
      sigest =    hyperparam$sigest,
      sigdf =     hyperparam$sigdf,
      sigquant =  hyperparam$sigquant,
      k =         hyperparam$k,
      power =     hyperparam$power,
      base =      hyperparam$base,
      sigmaf =    hyperparam$sigmaf,
      lambda =    hyperparam$lambda,
      numcut =    hyperparam$numcut,
      nskip =     hyperparam$nskip
    )$yhat.test
  
  return(pred_matrix)
}

Then I rerun the X_BART function and the EstimateCate set method code contained in the found in the R/XBART.R to get a local version of the function working. Just a quick hack, @soerenkuenzel This approach could be implemented with an if statement regarding .Platform$OS.type

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