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
湯村研究室の紹介2024 / yumulab2024
yumulab
0
280
大規模言語モデルのバイアス
yukinobaba
PRO
4
700
Practical The One Person Framework
asonas
1
1.6k
情報処理学会関西支部2024年度定期講演会「自然言語処理と大規模言語モデルの基礎」
ksudoh
6
800
Zipf 白色化:タイプとトークンの区別がもたらす良質な埋め込み空間と損失関数
eumesy
PRO
6
700
Weekly AI Agents News! 7月号 プロダクト/ニュースのアーカイブ
masatoto
0
160
Weekly AI Agents News! 10月号 論文のアーカイブ
masatoto
1
260
MIRU2024チュートリアル「様々なセンサやモダリティを用いたシーン状態推定」
miso2024
4
2.2k
Weekly AI Agents News!
masatoto
25
24k
文献紹介:A Multidimensional Framework for Evaluating Lexical Semantic Change with Social Science Applications
a1da4
1
220
クロスセクター効果研究会 熊本都市交通リノベーション~「車1割削減、渋滞半減、公共交通2倍」の実現へ~
trafficbrain
0
260
Weekly AI Agents News! 10月号 プロダクト/ニュースのアーカイブ
masatoto
1
120
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Scaling GitHub
holman
458
140k
How to train your dragon (web standard)
notwaldorf
88
5.7k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
97
Unsuck your backbone
ammeep
668
57k
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