-
Notifications
You must be signed in to change notification settings - Fork 14
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
Regularization - parameter selection #83
Comments
Hi, yes, this looks overall fine but here a few small errors/questions: Regularization:
Model specifications:
|
Thank you so much for your quick response and help! To answer your question (Is this intended that you tune only lambda and alpha for space and the associations?): No, but when I tune alpha, I got this error message: Error: vector memory exhausted (limit reached?). Though I have 16 Gb memory, but it seems it's not enough. When I don't tune, it works. |
Oh damn, this issue is actually on my to-do list...it is caused by the creation of the hyper-parameter tuning space: I naively create it with grid.expand(lambda_coef, lambda_cov, lambda_spatial, alpha_cov, alpha_cov, alpha_spatial) and then draw tune_steps random samples (rows) from this space (matrix)...which is of course not memory efficient... For now maybe just reduce the number of steps in your seq- functions then it should be possible to also tune environment. |
Ah okay! Now it works with "lambda_cov = seq(0, 0.1, 0.05), lambda_coef = seq(0, 0.1, 0.05)". Thanks again! |
Great! |
Hey Max, I took the liberty to create a new issue #84 to be able to discuss / close this independent of the question! |
Hi,
Thanks for developing the sjSDM and making it possible to use it in R!
I have a small fungal dataset (with ~500 OTUs and 40 samples (approx. 10 samples from 4 different sites) and some environmental + spatial data and I want to run sjSDM on this dataset. The main aim is to drawn some conclusions about community assembly processes, following Leibold et al.’s (2021, OIKOS) paper. However, this is the first time I’m using JSDM and not so sure how I should set up the right parameters for tuning. Following your script on github and the example in the R help section, I ended up with this script:
SPV=generateSpatialEV(env[,8:9])
tune = sjSDM_cv(env = as.matrix(Env), Y = as.matrix(Occ),
learning_rate = 0.001, iter = 100L, CV = nrow(Occ),
tune_steps = 40,
lambda_cov = seq(0, 0.1, 0.001),
lambda_coef = 0.1,
alpha_cov = seq(0, 1, 0.05),
alpha_coef = 0.5,
sampling = 100L,
biotic = bioticStruct(df=dim(Occ)[2]),
spatial = linear(SPV),
lambda_spatial = 2^seq(-10, -0.5, length.out = 20),
step_size = 5L,
blocks = 3L,
family=poisson("log"),
n_cores = 8)
best = head(tune$short_summary[order(tune$short_summary$logLik),])[1,]
model <- sjSDM(Y = as.matrix(Occ),
env = linear(as.matrix(Env), lambda = best[["lambda_coef"]], alpha = best[["alpha_coef"]]),
spatial = linear(SPV, ~0+., lambda = best[["lambda_spatial"]], alpha = best[["alpha_spatial"]]),
biotic = bioticStruct(lambda = best[["lambda_cov"]], alpha = best[["alpha_cov"]]),
family = poisson("log"),
iter = 100, learning_rate = 0.001)
Would you be so kind to take a quick look at this above and let me know if this setting would be appropriate to run the model, or if I should modify it somehow?
Thanks in advance!!!
The text was updated successfully, but these errors were encountered: