Cache the latest result of HSSP for speedup of MOTPE#5454
Cache the latest result of HSSP for speedup of MOTPE#5454nabenabe0928 wants to merge 11 commits intooptuna:masterfrom
Conversation
|
It seems that the change of this PR includes not only the cache on results of HSSP but also that on the split of TPE. Could you separate the change for the cache on the split into another PR? It would be great to discuss each item. |
|
FYI: How about utilizing |
|
@eukaryo thank you for the suggestion! |
|
@nabenabe0928 Thank you for your rapid reply! |
|
@eukaryo I got your point and tried lru_cache, but it seems lru_cache takes only hashable as arguments and neither list not Array can be hashed, so it didn't work. |
|
I see, that's unfortunate. I really appreciate your effort! |
HideakiImamura
left a comment
There was a problem hiding this comment.
Could you add unit tests to validate the cases in which the cache hit/doesn't hit?
I added a unittest! |
HideakiImamura
left a comment
There was a problem hiding this comment.
Thank you for the update. I have a comment for the test. PTAL.
| "storage", | ||
| (optuna.storages.RDBStorage("sqlite:///:memory:"), optuna.storages.InMemoryStorage()), | ||
| ) | ||
| def test_solve_hssp_with_cache(storage: optuna.storages.BaseStorage) -> None: |
There was a problem hiding this comment.
At first glance, it seems that this test includes too many preparations and logics. How about pre-determining the arguments of _solve_hssp_and_check_cache?
|
We discussed internally and decided to close this PR. |
Motivation
As the speed bottleneck of MOTPE comes from the HSSP calculation at each iteration, I introduce the caching for HSSP.
This is very important especially for
n_objectives > 2.Note that the split cache relates to the following PR:
_get_observation_pairsfor conditional parameters. #1166It is algorithmically wrong to consider different splits for different dimensions.
Description of the changes
I added a cache of the latest HSSP result to
study.system_attrs.Benchmarking Results
I did a benchmarking using a 2-dimensional 3-objective function with
n_trials=1000.My PR enables MOTPE to finish the optimization on this problem four times quicker with the identical optimization result.
Code