0

I use R in a jupyter notebook as described in this article. It work's perfectly fine. However, when I fit a GAM using the mgcv library and bam, e.g.:

dat <- gamSim(1,n=25000,dist="normal",scale=20)
bs <- "cr"; k <- 12
b <- bam(y ~ s(x0,bs=bs)+s(x1,bs=bs)+s(x2,bs=bs,k=k)+
           s(x3,bs=bs), data=dat, discrete=TRUE, nthreads=4)

the jupyter notebook does not utilize multiple cpu's at once. This is problematic as work with big data. Any ideas how to fix this?

1 Answer 1

0

You need to use discrete = TRUE to be able to use the nthreads argument. Read ?bam for ways to do the computation in parallel if you don’t want to use the discretisation option.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the reply. My fault. I use discrete=True in the notebook but forgot to include it in my question
@hyhno01 it's TRUE not True. Try running the code outside of a Jupyter notebook as that may be causing a problem. I believe nthreads requires the package to have been compiled with openMP support, so perhaps check that too?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.