最適化手法

Introduction to TensorFlow in Python

Isaiah Hull

Visiting Associate Professor of Finance, BI Norwegian Business School

最小値の見つけ方

画像はグランドキャニオンを示す。

1 出典: U.S. National Park Service
Introduction to TensorFlow in Python

最小値の見つけ方

画像はグランドキャニオンを示す。

1 出典: U.S. National Park Service
Introduction to TensorFlow in Python

最小値の見つけ方

画像はグランドキャニオンを示す。

1 出典: U.S. National Park Service
Introduction to TensorFlow in Python

図は単純な問題における SGD、RMSprop、Adam の学習経路を示す。

Introduction to TensorFlow in Python

勾配降下オプティマイザ

  • 確率的勾配降下法(SGD)オプティマイザ

    • tf.keras.optimizers.SGD()
    • learning_rate
  • シンプルで解釈しやすい

Introduction to TensorFlow in Python

RMSprop オプティマイザ

  • 二乗平均平方根(RMS)伝播オプティマイザ

    • 特徴ごとに異なる学習率を適用
    • tf.keras.optimizers.RMSprop()
    • learning_rate
    • momentum
    • decay
  • モメンタムの蓄積と減衰を両立

Introduction to TensorFlow in Python

Adam オプティマイザ

  • 適応的モーメント推定(Adam)オプティマイザ

    • tf.keras.optimizers.Adam()
    • learning_rate
    • beta1
  • デフォルト設定でも高性能

Introduction to TensorFlow in Python

完全な例

import tensorflow as tf

# Define the model function
def model(bias, weights, features = borrower_features):
    product = tf.matmul(features, weights)
    return tf.keras.activations.sigmoid(product+bias)
# Compute the predicted values and loss
def loss_function(bias, weights, targets = default, features = borrower_features):
    predictions = model(bias, weights)
    return tf.keras.losses.binary_crossentropy(targets, predictions)
# Minimize the loss function with RMS propagation
opt = tf.keras.optimizers.RMSprop(learning_rate=0.01, momentum=0.9)
opt.minimize(lambda: loss_function(bias, weights), var_list=[bias, weights])
Introduction to TensorFlow in Python

Let's practice!

Introduction to TensorFlow in Python

Preparing Video For Download...