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.4k
Optunaによる多目的最適化
Optuna Meetup #1 での発表資料です。
Yoshihiko Ozaki
June 29, 2021
Tweet
Share
Other Decks in Research
See All in Research
Inside Phishing Groups: Trust No One
0x1shu
0
110
Weekly AI Agents News! 10月号 論文のアーカイブ
masatoto
1
120
Weekly AI Agents News! 6月号 論文のアーカイブ
masatoto
1
190
DevGPT: Studying Developer-ChatGPT Conversations
taoxiaomark
0
120
ニューラルネットワークの損失地形
joisino
PRO
35
15k
Weekly AI Agents News! 7月号 論文のアーカイブ
masatoto
1
200
LINEチャットボット「全力肯定彼氏くん(LuC4)」の 1年を振り返る
o_ob
0
2.5k
論文読み会 SNLP2024 Instruction-tuned Language Models are Better Knowledge Learners. In: ACL 2024
s_mizuki_nlp
1
330
20240918 交通くまもとーく 未来の鉄道網編(こねくま)
trafficbrain
0
170
RCEへの近道
kawakatz
1
800
ミニ四駆AI用制御装置の事例紹介
aks3g
0
150
論文紹介/Expectations over Unspoken Alternatives Predict Pragmatic Inferences
chemical_tree
1
250
Featured
See All Featured
Navigating Team Friction
lara
183
14k
Code Review Best Practice
trishagee
64
17k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
For a Future-Friendly Web
brad_frost
175
9.4k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
107
49k
Into the Great Unknown - MozCon
thekraken
31
1.5k
RailsConf 2023
tenderlove
29
880
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
A designer walks into a library…
pauljervisheath
202
24k
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