codecamp

TensorFlow回调函数:tf.keras.callbacks.ReduceLROnPlateau

tf.keras.callbacks.ReduceLROnPlateau函数

类 ReduceLROnPlateau

继承自: Callback

定义在:tensorflow/python/keras/callbacks.py。

当指标停止提升时,降低学习速率。

一旦学习停止,模型通常会将学习率降低2-10倍。该回调监测数量,如果没有看到epoch的 'patience' 数量的改善,那么学习率就会降低。

示例:

reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.2,
                              patience=5, min_lr=0.001)
model.fit(X_train, Y_train, callbacks=[reduce_lr])

参数:

  • monitor:要监测的数量。
  • factor:学习速率降低的因素。new_lr = lr * factor
  • patience:没有提升的epoch数,之后学习率将降低。
  • verbose:int。0:安静,1:更新消息。
  • mode:{auto,min,max}之一。在min模式下,当监测量停止下降时,lr将减少;在max模式下,当监测数量停止增加时,它将减少;在auto模式下,从监测数量的名称自动推断方向。
  • min_delta:对于测量新的最优化的阀值,仅关注重大变化。
  • cooldown:在学习速率被降低之后,重新恢复正常操作之前等待的epoch数量。
  • min_lr:学习率的下限。

__init__

__init__(
    monitor='val_loss',
    factor=0.1,
    patience=10,
    verbose=0,
    mode='auto',
    min_delta=0.0001,
    cooldown=0,
    min_lr=0,
    **kwargs
)

初始化自我。

方法

in_cooldown
in_cooldown()
on_batch_begin
on_batch_begin(
    batch,
    logs=None
)
on_batch_end
on_batch_end(
    batch,
    logs=None
)
on_epoch_begin
on_epoch_begin(
    epoch,
    logs=None
)
on_epoch_end
on_epoch_end(
    epoch,
    logs=None
)
on_train_batch_begin
on_train_batch_begin(
    batch,
    logs=None
)
on_train_batch_end
on_train_batch_end(
    batch,
    logs=None
)
on_train_begin
on_train_begin(logs=None)
on_train_end
on_train_end(logs=None)
set_model
set_model(model)
set_params
set_params(params)


TensorFlow回调函数:tf.keras.callbacks.ProgbarLogger
TensorFlow回调函数:tf.keras.callbacks.RemoteMonitor
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }