Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Optunaによる多目的最適化

 Optunaによる多目的最適化

Optuna Meetup #1 での発表資料です。

Yoshihiko Ozaki

June 29, 2021
Tweet

Other Decks in Research

Transcript

  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
  2. ଟ໨త࠷దԽ • ໨త࠷దԽ໰୊ • ಉ࣌ʹ࠷దԽ͞ΕΔ ݸͷ໨తؔ਺͕ଘࡏ͢Δ໰୊ 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
  3. Optunaͱଟ໨త࠷దԽɿػցֶशʹ͓͚ΔԠ༻ • λεΫ • Hyperparameter Optimization • Neural Architecture Search

    • ໨తؔ਺ • Ϟσϧਫ਼౓ • ϞσϧαΠζʢ଎౓ɼফඅిྗʣ https://arxiv.org/abs/2105.01015 9
  4. • ղͷ༏ྼΛɼඇ༏ӽϥϯΫʹجͮ͘ऩଋੑɼࠞࡶڑ཭ʹجͮ͘ଟ༷ੑ ͷ؍఺͔Βܾఆ͠ɼ༏ΕͨղΛݩʹ࣍ੈ୅ͷݸମΛੜ੒ NSGA-II (Deb et al., 2002) ඇ༏ӽϥϯΫɿ༏ӽ͞Ε͍ͯͳ͍ղΛRank 1ͱͯͦ͜͠

    ͔Βॱʹऩଋੑʢ༏ӽؔ܎ʣʹԠͯ͡ϥϯΫ͕ܾ·Δ ࠞࡶڑ཭ɿྡΓ߹͏ݸମؒͷϚϯϋολϯڑ཭ͱͯ͠ ܭࢉ͞ΕΔʢ ʣɼ྆୺ʹ͍ͭͯ͸ ͱ໿ଋ͢Δ a + b ∞ 12
  5. 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
  6. MOTPE (Ozaki et al., 2020) • Optunaͷ୯໨త࠷దԽʹ͓͚Δඪ४ΞϧΰϦζϜͰ͋ΔTPEΛଟ໨త ࠷దԽʹ֦ுͨ͠΋ͷ • Ϟσϧ͸୳ࡧۭؒ಺ͷ༗๬ɾඇ༗๬ͳղʹ͍ͭͯΧʔωϧີ౓ਪఆ

    ༗๬ ඇ༗๬ ୳ࡧۭؒʹ͓͍ͯରԠ͢Δ༗๬ͳղͷू߹ʹ ͍ͭͯΧʔωϧີ౓ਪఆ ୳ࡧۭؒʹ͓͍ͯରԠ͢Δඇ༗๬ͳղͷू߹ʹ ͍ͭͯΧʔωϧີ౓ਪఆ 15
  7. 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
  8. 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
  9. ՄࢹԽ • ࢄ෍ਤ • (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
  10. ධՁ • ϋΠύϘϦϡʔϜ ... # ϋΠύϘϦϡʔϜܭࢉؔ਺͸͍·ͷͱ͜Ζ։ൃऀ޲͚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