Slow bayesopt initialization in parallel computing
Show older comments
Hi,
I am using a gaussian process regression model to fit my data through fitrgp function. I self defined a sort of complex kernel. I texted on a small subset of my data and got satisfied result. Now I apply it to my whole data with ‘UseParallel’ on. My questions are following:
1. Say I have 64 cores and set 1 worker per core. With setup as:
'OptimizeHyperparameters','auto', ...
'HyperparameterOptimizationOptions',...
struct('UseParallel', true, ...
'MaxObjectiveEvaluations', 64, ...
'Repartition', true, ...
'kfold', 20));
I understand the optimizer is bayesian opt, but how does the parallel look like? Is each objective function evaluation performed on all 64 workers simultaneously, and 64 evaluations go serial? Or instead, each evolution is computed on one worker, and 64 evaluations on their specific cores are computed in parallel?
2. I noticed, after getting the message:
“Copying objective function to workers...
Done copying objective function to workers.”
It takes quite a while (hours) before printing out further evaluation information. I guess it is because the initialization of bayesopt. Anything I can do to speed it up?
I also noticed, after getting the first evaluation print, the further 63 results are relatively faster. Why is that?
Thank you very much for your help.
Mono
Accepted Answer
More Answers (1)
Alan Weiss
on 27 Nov 2018
0 votes
Perhaps the documentation in Parallel Bayesian Optimization can help. In particular, there are descriptions of several methods of getting the objective function onto the workers.
Also, and I do not know if this is what you are seeing, most MATLAB operations are faster the second time they are executed because MATLAB, an interpreted language, compiles on the fly and uses the compiled code in later calls.
Alan Weiss
MATLAB mathematical toolbox documentation
3 Comments
mono
on 28 Nov 2018
mono
on 28 Nov 2018
Alan Weiss
on 28 Nov 2018
The Bayesian optimization features in fitgrp are not as flexible or extensible as those in bayesopt itself. You will probably have to use bayesopt to do what you want most efficiently. And I hope that you noticed the descriptions of various ways of getting the objective function onto the workers. Some can save considerable time, especially for repeated optimizations, where you can leave the objective functions on the workers and just change some data.
Alan Weiss
MATLAB mathematical toolbox documentation
Categories
Find more on Gaussian Process Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!