Skip to content
Keras implement of Lazy optimizer
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md Update README.md Jul 30, 2019
imdb_lstm_test.py Create imdb_lstm_test.py Jul 30, 2019
lazyoptimizer.py Update lazyoptimizer.py Jul 30, 2019

README.md

Keras Implement of Lazy Optimizer

Inheriting Optimizer class, wrapping the original optimizer to achieve a new corresponding lazy optimizer.

Here we use gradients are equal to zeros or not to distinguish whether the words are sampled or not.

Usage

just replace your original with-momentum optimizer, like Adam(1e-3), with LazyOptimizer(Adam(1e-3), embedding_layers).

see imdb_lstm_test.py.

Lazy类优化器的Keras实现

继承Optimizer类,包装原有优化器,实现Lazy版优化器。

这里判断一个词是否被采样的方法是检查该词的梯度是否全为0。

用法

直接将原来用的带动量的优化器, 如 Adam(1e-3), 替换为 LazyOptimizer(Adam(1e-3), embedding_layers) 就行了.

参考 imdb_lstm_test.py.

You can’t perform that action at this time.