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
さんかくのテスト.pdf
sankaku0724
0
340
MIRU2024_招待講演_RALF_in_CVPR2024
udonda
1
330
文書画像のデータ化における VLM活用 / Use of VLM in document image data conversion
sansan_randd
2
190
ニュースメディアにおける事前学習済みモデルの可能性と課題 / IBIS2024
upura
3
510
Active Adaptive Experimental Design for Treatment Effect Estimation with Covariate Choices
masakat0
0
220
メールからの名刺情報抽出におけるLLM活用 / Use of LLM in extracting business card information from e-mails
sansan_randd
2
140
[ECCV2024読み会] 衛星画像からの地上画像生成
elith
1
660
Tietovuoto Social Design Agency (SDA) -trollitehtaasta
hponka
0
2.5k
Geospecific View Generation - Geometry-Context Aware High-resolution Ground View Inference from Satellite Views
satai
1
100
Weekly AI Agents News! 9月号 論文のアーカイブ
masatoto
1
120
精度を無視しない推薦多様化の評価指標
kuri8ive
1
240
クロスセクター効果研究会 熊本都市交通リノベーション~「車1割削減、渋滞半減、公共交通2倍」の実現へ~
trafficbrain
0
250
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
A Modern Web Designer's Workflow
chriscoyier
693
190k
A Tale of Four Properties
chriscoyier
156
23k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Facilitating Awesome Meetings
lara
50
6.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
GitHub's CSS Performance
jonrohan
1030
460k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
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