Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there,
While running hyperopt in Ray Tune with large number of samples, I noticed that performance was dropping quite fast after a few hundreds of them.
I did some profiling using
cProfile
and noticed thatGMM1_lpdf
had a important total time of execution. See below an example of profiling results sorted by total time2 things to notice:
GMM1_lpdf
total time is largenormal_cdf
total time is large too, and its number of calls is quite important.Looking at
GMM1_lpdf
code, the code block that callsnormal_cdf
most is the following:hyperopt/hyperopt/tpe.py
Lines 153 to 166 in 0658f68
Several observations here:
lbound
andubound
don't depend on for loop parametersnormal_cdf
depends on length of given arrays, which grows with number of samples.After analyzing the impact, I drafted a "vectorized" version of the code, which doesn't rely on for loop anymore but executes the computation in one pass.
Tests are passing, and I've been able to validate the results with in-house experiments too.
Feedback appreciated!