Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

learningrate scheduler tensorflow

tf.keras.callbacks.LearningRateScheduler(
    schedule, verbose=0)

# This function keeps the initial learning rate for the first ten epochs
# and decreases it exponentially after that.

def scheduler(epoch, lr):
  if epoch < 10:
    return lr
  else:
    return lr * tf.math.exp(-0.1)

model = tf.keras.models.Sequential([tf.keras.layers.Dense(10)])
model.compile(tf.keras.optimizers.SGD(), loss='mse')

callback = tf.keras.callbacks.LearningRateScheduler(scheduler)
history = model.fit(np.arange(100).reshape(5, 20), np.zeros(5),
                    epochs=15, callbacks=[callback], verbose=0)
Comment

PREVIOUS NEXT
Code Example
Python :: df concat 
Python :: multiply all values in column pandas 
Python :: create a df in pandas 
Python :: pandas append index ignore 
Python :: pandas create new column and fill with constant value 
Python :: python solve equation with two variables 
Python :: python timestamp 
Python :: tkinter frame inside frame 
Python :: convert keys to values in python 
Python :: how many days until 2021 
Python :: 2d array pytho 
Python :: how to send emails in python 
Python :: matplotlib plot 2d point 
Python :: how to do http requetss python 
Python :: python process memory usage 
Python :: replace number with string python 
Python :: tkinter radio buttons 
Python :: bs4 python delete element 
Python :: python check folder exists 
Python :: python subprocess with environment variables 
Python :: convex hull algorithm python 
Python :: django sort descending 
Python :: reset django database 
Python :: pytest check exception 
Python :: how to plot corilation python 
Python :: python datetime get all days between two dates 
Python :: check if part of list is in another list python 
Python :: pyttsx3 female voice template 
Python :: python open file 
Python :: How to get the value of an Entry widget in Tkinter? 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =