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
The Relevance of UX for Conversion and Monetisation
itasohaakhib1
0
120
129 2 th
0325
0
250
FOSS4G 山陰 Meetup 2024@砂丘 はじめの挨拶
wata909
1
120
CUNY DHI_Lightning Talks_2024
digitalfellow
0
130
Weekly AI Agents News! 8月号 論文のアーカイブ
masatoto
1
220
20240918 交通くまもとーく 未来の鉄道網編(太田恒平)
trafficbrain
0
360
新規のC言語処理系を実装することによる 組込みシステム研究にもたらす価値 についての考察
zacky1972
1
270
多様かつ継続的に変化する環境に適応する情報システム/thesis-defense-presentation
monochromegane
1
590
ソフトウェア研究における脅威モデリング
laysakura
0
940
秘伝:脆弱性診断をうまく活用してセキュリティを確保するには
okdt
PRO
4
770
Practical The One Person Framework
asonas
1
1.8k
【NLPコロキウム】Stepwise Alignment for Constrained Language Model Policy Optimization (NeurIPS 2024)
akifumi_wachi
2
230
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
94
13k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Faster Mobile Websites
deanohume
305
30k
Agile that works and the tools we love
rasmusluckow
328
21k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Optimizing for Happiness
mojombo
376
70k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Automating Front-end Workflow
addyosmani
1366
200k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
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