Optimiseurs

Introduction à TensorFlow en Python

Isaiah Hull

Visiting Associate Professor of Finance, BI Norwegian Business School

Comment trouver un minimum

L'image montre le Grand Canyon.

1 Source : U.S. National Park Service
Introduction à TensorFlow en Python

Comment trouver un minimum

L'image montre le Grand Canyon.

1 Source : U.S. National Park Service
Introduction à TensorFlow en Python

Comment trouver un minimum

L'image montre le Grand Canyon.

1 Source : U.S. National Park Service
Introduction à TensorFlow en Python

La figure montre le parcours d'apprentissage des optimiseurs SGD, RMSprop et Adam pour un problème simple.

Introduction à TensorFlow en Python

L'optimiseur de descente de gradient

  • Optimiseur Stochastic gradient descent (SGD)

    • tf.keras.optimizers.SGD()
    • learning_rate
  • Simple et facile à interpréter

Introduction à TensorFlow en Python

L'optimiseur RMSprop

  • Optimiseur Root mean squared (RMS) propagation

    • Applique des taux d'apprentissage différents à chaque caractéristique
    • tf.keras.optimizers.RMSprop()
    • learning_rate
    • momentum
    • decay
  • Permet au momentum d'augmenter et de décroître

Introduction à TensorFlow en Python

L'optimiseur Adam

  • Optimiseur Adaptive moment (Adam)

    • tf.keras.optimizers.Adam()
    • learning_rate
    • beta1
  • Donne de bons résultats avec les valeurs par défaut

Introduction à TensorFlow en Python

Exemple complet

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 à TensorFlow en Python

Passons à la pratique !

Introduction à TensorFlow en Python

Preparing Video For Download...