Pendahuluan TensorFlow di Python
Isaiah Hull
Visiting Associate Professor of Finance, BI Norwegian Business School




Pengoptimal stochastic gradient descent (SGD)
tf.keras.optimizers.SGD()learning_rateSederhana dan mudah dipahami
Pengoptimal root mean squared (RMS) propagation
tf.keras.optimizers.RMSprop()learning_ratemomentumdecayMemungkinkan momentum bertambah lalu berkurang
Pengoptimal adaptive moment (Adam)
tf.keras.optimizers.Adam()learning_ratebeta1Kinerja baik dengan nilai default
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])
Pendahuluan TensorFlow di Python