2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OPTUNAを使ってみる

Posted at

話題のOptunaを使ってみました。PFNのハイパーパラメータ最適化ソフトウェアです。

もともとは機械学習などのパラメータ最適化用とのことですが、汎用性があるようで、CAEなどの形状パラメータ最適化にも使えそうです。

※ トポロジー最適化とか組み合わせ最適化は適用可能かどうか、もう少し調べてみます。

導入方法(python3)

導入は極めて簡単でした。python2系列にも対応しているようですが、python3で使うことにします。

方法1) Gitでダウンロード&インストール

$ git clone https://github.com/pfnet/optuna.git
$ cd optuna
$ sudo python3 setup.py install

方法2)PIPでインストール。

$ pip3 install git+https://github.com/pfnet/optuna.git

最適化の例1:単目的関数の最適化

import numpy as np
import optuna

def objective(trial):
   x = trial.suggest_uniform('x', -1, 1)
   y = trial.suggest_uniform('y', -1, 1)
   return -10**(-(x-0.1)**2)*10**(-y**2)*np.sin(5*x)*np.sin(3*y)

study = optuna.create_study()

study.optimize(objective, n_trials=200)

print(study.best_params)

最適化の例2:多目的関数の最適化

とここまで書いてきてなんですが、複数の目的関数や制約条件ってとれるのかな。
公式ドキュメントには、それらしい解説がないようです。
設計空間の定義は、一通りそろってるようですが...。

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?