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

Parallelization error when optimizing parameters for NicheNet #105

Open
tkapello opened this issue Aug 1, 2024 · 0 comments
Open

Parallelization error when optimizing parameters for NicheNet #105

tkapello opened this issue Aug 1, 2024 · 0 comments

Comments

@tkapello
Copy link

tkapello commented Aug 1, 2024

Hi,

I am implementing the Omnipath resources for NicheNet analysis on a Windows computer. I was optimizing the parameters for the model as shown below:

# Parameter optimization
expression_settings_validation<-readRDS(url("https://zenodo.org/record/3260758/files/expression_settings.rds"))

my_source_weights_df<-tibble(source=unique(c(lr_network$source, sig_network$source, gr_network$source)), weight=rep(1, length(unique(c(lr_network$source, sig_network$source, gr_network$source)))))

additional_arguments_topology_correction<-list(source_names=my_source_weights_df$source %>% unique(), 
                                               algorithm="PPR", 
                                               correct_topology=FALSE,
                                               lr_network=lr_network, 
                                               sig_network=sig_network, 
                                               gr_network=gr_network, 
                                               settings=lapply(expression_settings_validation, convert_expression_settings_evaluation),
                                               secondary_targets=FALSE, 
                                               remove_direct_links="no", 
                                               cutoff_method="quantile")

nr_datasources<-additional_arguments_topology_correction$source_names %>% length()

obj_fun_multi_topology_correction<-makeMultiObjectiveFunction(name="nichenet_optimization",
                                                              description="data source weight and hyperparameter optimization: expensive black-box function",
                                                              fn=model_evaluation_optimization, 
                                                              par.set=makeParamSet(makeNumericVectorParam("source_weights", len=nr_datasources, lower=0, upper=1, tunable=FALSE),
                                                                                   makeNumericVectorParam("lr_sig_hub", len=1, lower=0, upper=1, tunable=TRUE),  
                                                                                   makeNumericVectorParam("gr_hub", len=1, lower=0, upper=1, tunable=TRUE),  
                                                                                   makeNumericVectorParam("ltf_cutoff", len=1, lower=0.9, upper=0.999, tunable=TRUE), 
                                                                                   makeNumericVectorParam("damping_factor", len=1, lower=0.01, upper=0.99, tunable=TRUE)), 
                                                              has.simple.signature=FALSE,
                                                              n.objectives=4, 
                                                              noisy=FALSE,
                                                              minimize=c(FALSE, FALSE, FALSE, FALSE))

optimization_results=lapply(1, mlrmbo_optimization, obj_fun=obj_fun_multi_topology_correction, niter=8, ncores=5, nstart=1250, additional_arguments=additional_arguments_topology_correction)

However, I have an error:

Error in parallelStart(mode = MODE_MULTICORE, cpus = cpus, level = level,  : 
  Multicore mode not supported on windows!

I understand that the issue is the Windows OS which can not use several cores to process functions but I have not found a workaround with parallelStart(mode='socket', cpus=5) with no success. I would appreciate any support!

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

1 participant