Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Optunaによる多目的最適化
Search
Yoshihiko Ozaki
June 29, 2021
Research
5
3.5k
Optunaによる多目的最適化
Optuna Meetup #1 での発表資料です。
Yoshihiko Ozaki
June 29, 2021
Tweet
Share
Other Decks in Research
See All in Research
20241115都市交通決起集会 趣旨説明・熊本事例紹介
trafficbrain
0
710
Tietovuoto Social Design Agency (SDA) -trollitehtaasta
hponka
0
3k
The Fellowship of Trust in AI
tomzimmermann
0
150
LiDARとカメラのセンサーフュージョンによる点群からのノイズ除去
kentaitakura
0
180
チュートリアル:Mamba, Vision Mamba (Vim)
hf149
5
1.6k
論文読み会 KDD2024 | Relevance meets Diversity: A User-Centric Framework for Knowledge Exploration through Recommendations
cocomoff
0
110
データサイエンティストをめぐる環境の違い 2024年版〈一般ビジネスパーソン調査の国際比較〉
datascientistsociety
PRO
0
780
医療支援AI開発における臨床と情報学の連携を円滑に進めるために
moda0
0
120
TransformerによるBEV Perception
hf149
1
580
LLM時代にLabは何をすべきか聞いて回った1年間
hargon24
1
530
アプリケーションから知るモデルマージ
maguro27
0
170
熊本から日本の都市交通政策を立て直す~「車1割削減、渋滞半減、公共交通2倍」の実現へ~@公共交通マーケティング研究会リスタートセミナー
trafficbrain
0
180
Featured
See All Featured
Designing for Performance
lara
604
68k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Site-Speed That Sticks
csswizardry
2
190
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
520
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
RailsConf 2023
tenderlove
29
940
Visualization
eitanlees
146
15k
Building an army of robots
kneath
302
44k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
97
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Mobile First: as difficult as doing things right
swwweet
222
9k
Transcript
OptunaʹΑΔଟత࠷దԽ Optuna Meetup #1 2021/06/26 ඌ࡚ Յ 1
ඌ࡚ Յ • ॴଐ • άϦʔגࣜձࣾʗ࢈ۀٕज़૯߹ݚڀॴਓೳηϯλʔ • ࠷ۙͷݚڀ • Ozaki,
Y., Tanigaki, Y., Watanabe, S., & Onishi, M. (2020). Multiobjective tree-structured parzen estimator for computationally expensive optimization problems. In Proceedings of the 2020 Genetic and Evolutionary Computation Conference (pp. 533-541). • Ozaki, Y., Suzuki, Y., Hawai, T., Saito, K., Onishi, M., & Ono, K. (2020). Automated crystal structure analysis based on blackbox optimisation. npj Computational Materials, 6(1), 1-7. • ඌ࡚Յ, ଜক, & େਖ਼ً. (2020). ػցֶशʹ͓͚ΔϋΠύύϥϝʔλ࠷దԽख๏: ֓ཁͱಛ . ిࢠใ௨৴ֶձจࢽ D, 103(9), 615-631. 2
࣍ • ͡Ίʹɿଟత࠷దԽ • Optunaɿଟత࠷దԽख๏ • Optunaɿଟత࠷దԽؔ࿈ػೳ • ·ͱΊ 3
͡Ίʹɿଟత࠷దԽ 4
ଟత࠷దԽ • త࠷దԽ • ಉ࣌ʹ࠷దԽ͞ΕΔ ݸͷత͕ؔଘࡏ͢Δ • ྫɿాۭߓ 㱺 ϑϥϯΫϑϧτؒͷҠಈϓϥϯ
• ✔ Ҡಈ࣌ؒͷ࠷খԽ 㱻 ✔ අ༻ͷ࠷খԽʢ2ͭͷతτϨʔυΦϑͷؔʣ m m 5
ଟత࠷దԽ • త࠷దԽ • ಉ࣌ʹ࠷దԽ͞ΕΔ ݸͷత͕ؔଘࡏ͢Δ m m తۭؒ (f1
(x), f2 (x)) ୈ2తɿf2 (x) ୈ1తɿf1 (x) 2త࠷খԽ Minimize/Maximize subject to ɿ ൪ͷతؔ ɿܾఆม ɿ࣮ߦՄೳྖҬ f1 (x), f2 (x), …, fm (x) x ∈ X fi (x) i x X ୳ࡧۭؒ X x1 x2 ࣸ૾ 6
ଟత࠷దԽ • ଟత࠷దԽͰɼ୯Ұͷ࠷దղҰൠʹଘࡏ͠ͳ͍ • ଞͷҙͷղʹ༏ӽ͞Εͳ͍શͯͷղͷू߹ΛύϨʔτηοτͱݺͼ ύϨʔτηοτͷతۭؒͰͷ૾ΛύϨʔτϑϩϯτͱݺͿ ύϨʔτϑϩϯτ ྉۚ Ҡಈ࣌ؒ 2తʢҠಈ࣌ؒɼྉۚʣ࠷খԽ
༏ӽؔ • ABΛ༏ӽ͢Δ • AͱCൺֱෆՄೳͷؔ ଟత࠷దԽΛղ͘ͱύϨʔτηοτ ΛٻΊΔʢۙࣅ͢Δʣ͜ͱ 7
Optunaɿଟత࠷దԽख๏ 8
Optunaͱଟత࠷దԽɿػցֶशʹ͓͚ΔԠ༻ • λεΫ • Hyperparameter Optimization • Neural Architecture Search
• తؔ • Ϟσϧਫ਼ • ϞσϧαΠζʢɼফඅిྗʣ https://arxiv.org/abs/2105.01015 9
ଟత࠷దԽख๏ • ݱࡏOptunaͰར༻Մೳͳख๏ • ਐԽܕଟత࠷దԽɿNSGA-II • ଟతϕΠζ࠷దԽɿMOTPEɼqEHVI (integration.botorch) 10
ਐԽܕଟత࠷దԽ • ਐԽܭࢉΛ༻͍Δ͜ͱͰɼύϨʔτϑϩϯτΛۙࣅ͢Δղू߹ΛҰ ͷ࣮ߦͰಉ࣌ʹ֫ಘ͢Δ͜ͱΛతͱͨ͠ख๏ 11
• ղͷ༏ྼΛɼඇ༏ӽϥϯΫʹجͮ͘ऩଋੑɼࠞࡶڑʹجͮ͘ଟ༷ੑ ͷ؍͔Βܾఆ͠ɼ༏ΕͨղΛݩʹ࣍ੈͷݸମΛੜ NSGA-II (Deb et al., 2002) ඇ༏ӽϥϯΫɿ༏ӽ͞Ε͍ͯͳ͍ղΛRank 1ͱͯͦ͜͠
͔Βॱʹऩଋੑʢ༏ӽؔʣʹԠͯ͡ϥϯΫ͕ܾ·Δ ࠞࡶڑɿྡΓ߹͏ݸମؒͷϚϯϋολϯڑͱͯ͠ ܭࢉ͞ΕΔʢ ʣɼ྆ʹ͍ͭͯ ͱଋ͢Δ a + b ∞ 12
Optunaʹ͓͍ͯ NSGA-IIΛ͏ import optuna def objective(trial): x = trial.suggest_float("x", 0,
5) y = trial.suggest_float("y", 0, 3) v0 = 4 * x ** 2 + 4 * y ** 2 v1 = (x - 5) ** 2 + (y - 5) ** 2 return v0, v1 # objectiveશͯͷతؔΛฦ͢ # NSGAIISamplerΛ͏ sampler = optuna.samplers.NSGAIISampler(seed=1234) study = optuna.create_study( sampler=sampler, directions=["minimize", "minimize"] ) study.optimize(objective, n_trials=250) 13
ଟతϕΠζ࠷దԽ • తؔ୳ࡧۭؒʹ͍ͭͯϕΠζతͳϞσϧΛߏங͠ɼ֫ಘؔͱ ݺΕΔج४Λ༻͍ͯ༗ͳղΛޮతʹαϯϓϧ͢Δख๏ • తؔΛϞσϧԽɿຆͲͷଟతϕΠζ࠷దԽख๏ • ୳ࡧۭؒΛϞσϧԽɿMOTPE 14
MOTPE (Ozaki et al., 2020) • Optunaͷ୯త࠷దԽʹ͓͚Δඪ४ΞϧΰϦζϜͰ͋ΔTPEΛଟత ࠷దԽʹ֦ுͨ͠ͷ • Ϟσϧ୳ࡧۭؒͷ༗ɾඇ༗ͳղʹ͍ͭͯΧʔωϧີਪఆ
༗ ඇ༗ ୳ࡧۭؒʹ͓͍ͯରԠ͢Δ༗ͳղͷू߹ʹ ͍ͭͯΧʔωϧີਪఆ ୳ࡧۭؒʹ͓͍ͯରԠ͢Δඇ༗ͳղͷू߹ʹ ͍ͭͯΧʔωϧີਪఆ 15
MOTPE (Ozaki et al., 2020) • ࣍ʹධՁ͢ΔղExpected Hypervolume Improvement (EHVI)
֫ಘؔʹΑܾͬͯΊΔ • ू߹ ʹ ΛՃ͑ͨͱ͖ͷϋΠύϘϦϡʔϜ૿ՃྔͷظʹରԠɼ͜ΕΛ࠷େԽ͢Δ Λ࠾༻ • ࣮༗ɾඇ༗ྖҬͷ֬ີΛ ɼ ͱͨ͠ͱ͖ɼ ͕Γཱͭ EHVIY* (x) := ∫ max(IH (Y* ∪ {y}) − IH (Y*),0)p(y ∣ x)dy Y* y = f(x) x l(x) g(x) argmaxx EHVI(x) = argmaxx l(x)/g(x) Y r • ϋΠύϘϦϡʔϜ ʹଐ͢ΔϕΫτϧͱࢀর ʹғ·ΕͨྖҬ ͷମੵʢփ৭෦ʣ • ύϨʔτϑϩϯτମੵΛ࠷େԽ͢Δ Y r 16
Optunaʹ͓͍ͯ MOTPEΛ͏ ... # MOTPESamplerʹมߋ͢Δ͚ͩ sampler = optuna.samplers.MOTPESampler(seed=1234) study =
optuna.create_study( sampler=sampler, directions=["minimize", “minimize"] ) study.optimize(objective, n_trials=250) 17
ൺֱɿNSGA-IIͱMOTPE ؆୯ͳͰ͋ΕͲͪΒͰ͙͢ղ͚Δ 18
ൺֱɿNSGA-IIͱMOTPE • ऩଋMOTPEͷํ͕͍ ʢAutoML͖ʣ ͖ͬ͞ΑΓ͍͠ʢධՁճ250ʣ 19
ൺֱɿNSGA-IIͱMOTPE • ऩଋMOTPEͷํ͕͍ ʢAutoML͖ʣ • MOTPEධՁճʹݶք͋Γ ʢNSGA-IIزΒͰʣ MOTPE1000ճͰ15-20ఔɼଞͷଟత ϕΠζ࠷దԽख๏ʢPESMOSMS-EGOʣΑΓ ѹతʹ͍͕NSGA-IIͱൺΔͱʹͳΒͳ͍
20
ൺֱɿNSGA-IIͱMOTPE • ऩଋMOTPEͷํ͕͍ ʢAutoML͖ʣ • MOTPEධՁճʹݶք͋Γ ʢNSGA-IIزΒͰʣ • ७ਮͳࢄ࠷దԽNSGA-II͕ Α͍ʢMOTPEہॴղʹऩଋʣ
0-1φοϓαοΫʢ2త࠷େԽʣ 21
Optunaɿଟత࠷దԽؔ࿈ػೳ 22
ՄࢹԽ • ࢄਤ • (Parallel coordinate) ... sampler = optuna.samplers.MOTPESampler(seed=1234)
study = optuna.create_study(sampler=sampler, directions=["minimize", "minimize"]) study.optimize(objective, n_trials=250) # plotlyϕʔεͷՄࢹԽ fig = optuna.visualization.plot_pareto_front(study) fig.show() # matplotlibϕʔεͷՄࢹԽ optuna.visualization.matplotlib.plot_pareto_front( study ) plt.show() 23
ධՁ • ϋΠύϘϦϡʔϜ ... # ϋΠύϘϦϡʔϜܭࢉ͍ؔ·ͷͱ͜Ζ։ൃऀ͚API # কདྷతʹoptuna/_hypervolume/wfg.pyʹҠಈ͞ΕΔ༧ఆ wfg =
optuna.multi_objective._hypervolume.WFG() reference_point = np.array([3, 5]) trials = study.trials hvs = [] for i in range(1, len(trials) + 1): vector_set = np.array( [t.values for t in trials[:i]] ) hvs.append( wfg.compute(vector_set, reference_point) ) plt.style.use(“ggplot") plt.xlabel("Number of valuations") plt.ylabel("Hypervolume") plt.plot(range(1, len(hvs) + 1), hvs) plt.show() 24
·ͱΊ • ଟత࠷దԽύϨʔτ࠷దղͷू߹Λ֫ಘ͢Δ͜ͱ͕ඪ • OptunaਐԽܕଟత࠷దԽͱଟతϕΠζ࠷దԽͷ2λΠϓͷख๏Λఏڙ • લऀ൚༻తɼNSGA-IIͦͷ࠷දతͳख๏Ͱ20ؒͷ࣮͕͋Δ • ޙऀAutoML͖ɼMOTPEϋΠύύϥϝʔλ࠷దԽख๏TPEͷଟత൛ •
Optunaͷଟత࠷దԽؔ࿈ػೳΛհ • ଟత࠷దԽɼ୯త࠷దԽʹൺͯ׆༻ࣄྫ։ൃऀগͳ͍ɼࠓճΛ ͖͔͚ͬʹϢʔβ։ൃऀ͕૿͑Δͱخ͍͠ 25