feat: Improve Acquisition Function optimization in discrete and mixed search spaces#257
feat: Improve Acquisition Function optimization in discrete and mixed search spaces#257Sohambasu07 wants to merge 15 commits intomasterfrom
Conversation
…h for mixed spaces
|
Can you also share your observation regarding performance improvement using |
| from neps.space.encoding import ConfigEncoder | ||
|
|
||
|
|
||
| class WrappedAcquisition(AcquisitionFunction): |
There was a problem hiding this comment.
Shall we rename it to something conveying the mission of this class better?
maybe FixedNeumericalAcquisition
There was a problem hiding this comment.
I kept it as WrappedAcquisition because it's pretty much what it does. I was a bit conflicted too since fixing the numericals is not the main thing it does, but rather optimizing over only the categorical space.
So, previously the number of allowed categorical combinations were 30, because the complexity of the outer loop in botorch's I would say that the performance improvement is that this PR makes it possible to optimize over any large search space within seconds (about 10 seconds per BO loop). |
Issue
30combinations for search spaces with categorical hyperparameters (Limit on categoricals in GP #219).Additions and Deletions
maximum_allowed_categorical_combinationswhich previously set a cap on number of allowed categorical combinations in the search space.optimize_acqf_mixed()WrappedAcquisitionmodule inneps.optimizers.acquisition.wrapped_acquisition.optimize_acqf_discrete_local_search()for purely categorical and mixed search spaces.What remains the same
num_restarts:optimize_acqf_mixedusing all possible categorical combinations asfixed_features.optimize_acqf_discrete_local_searchwhich we now use for search spaces with large number of categoricals fails to generatenum_restartsnumber of minimum candidates if the total number of categorical combinations is lower thannum_restarts. Sincenum_restartsis usually very low (defaults to 20 in NePS GP), this will not be very computationally expensive.What has changed:
For search spaces with a high number of categorical dimensions (and
n_combos>num_restarts), the following changes have been introduced:Purely categorical search spaces (:
optimize_acqf_mixed()withoptimize_discrete_local_search()which scales better with increasing number of categorical dimensions and combinations.Mixed search spaces:
optimize_acqf().WrappedAcquisitionto keep the best seen values of the continuous features fixed and optimize only over the categoricals usingoptimize_acqf_discrete_local_search(). Finally, we merge the best seen values of both the numerical and categorical features into a single tensor, perform one forward pass over the acquisition function and return the candidate and the score.Tests
PriMO,BOandPriorbandBOon theJAHSBench CIFAR10task.