# Parallel bayesopt: what is the relationship between the number of iterations and number of workers?

3 views (last 30 days)
Simon Stone on 18 Dec 2019
Commented: Simon Stone on 24 Dec 2019
I am having a hard time wrapping my head around how exactly parallel Bayes optimization works in Matlab. Maybe someone can help me out with this:
Regular Bayes optimization evaluates a number of parameter combinations equal to the number of iterations: at every iteration one combination is used, the internal GP model is updated, the new parameter combination is determined, and a new iteration begins.
In parallel Bayes optimization, the documentation says "bayesopt assigns points to evaluate to the parallel workers, generally one point at a time". So by my understanding, if I had 5 workers and 10 iterations I could evaluate the same number of parameter combinations as in non-parallel bayesopt (so 1 worker) and 50 iterations. I understand that there are some differences between those approaches in terms of which point is chosen next and so on, but in principle this is correct, right?
So with this understanding, I don't know how to interpret this output:
|==============================================================================================================================|
| Iter | Active | Eval | Objective | Objective | BestSoFar | BestSoFar | win_length | window | Pmin |
| | workers | result | | runtime | (observed) | (estim.) | | | |
|==============================================================================================================================|
| 1 | 24 | Best | 496.42 | 736.15 | 496.42 | 496.42 | 32 | kaiser(3) | 25 |
| 2 | 24 | Best | 410.36 | 4913.8 | 410.36 | 413.78 | 32 | hann | 96 |
| 3 | 24 | Best | 322.27 | 6739.4 | 322.27 | 408.17 | 64 | kaiser(12) | 20 |
At every iteration, 24 workers are active. Are 24 points evaluated? Are the reported parameter values then only the best ones from that batch? Which ones were attempted?
Any help to understand this would be greatly appreciated.

Don Mathis on 23 Dec 2019
For parallel bayesopt, the first column shown is actually the function evaluation number. It's not exactly right to call it an iteration.
The algorithm runs jobs (function evaluations) asynchronously in parallel using the parfeval function. Jobs take different amounts of time, and when a job finishes, it is replaced with a new one, while the other jobs continue running. Whenever a job finishes, a new line of output is printed. So you are seeing all the evaluations.
Note that you don't tell bayesopt how many iterations to run, you tell it how many objective evaluations to run ('MaxObjectiveEvaluations').
I've omitted some details about what happens when multiple jobs finish at the same time, or when they finish so fast that you get idle workers.
Simon Stone on 24 Dec 2019
Thanks for this answer, that helps a lot!