Introduction to TensorFlow in Python
Isaiah Hull
Visiting Associate Professor of Finance, BI Norwegian Business School




確率的勾配降下法(SGD)オプティマイザ
tf.keras.optimizers.SGD()learning_rateシンプルで解釈しやすい
二乗平均平方根(RMS)伝播オプティマイザ
tf.keras.optimizers.RMSprop()learning_ratemomentumdecayモメンタムの蓄積と減衰を両立
適応的モーメント推定(Adam)オプティマイザ
tf.keras.optimizers.Adam()learning_ratebeta1デフォルト設定でも高性能
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