All Projects → cpury → keras_gradient_noise

cpury / keras_gradient_noise

Licence: MIT license
Add gradient noise to any Keras optimizer

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to keras gradient noise

Adahessian
ADAHESSIAN: An Adaptive Second Order Optimizer for Machine Learning
Stars: ✭ 114 (+216.67%)
Mutual labels:  optimizer
Draftfast
A tool to automate and optimize DraftKings and FanDuel lineup construction.
Stars: ✭ 192 (+433.33%)
Mutual labels:  optimizer
artificial-neural-variability-for-deep-learning
The PyTorch Implementation of Variable Optimizers/ Neural Variable Risk Minimization proposed in our Neural Computation paper: Artificial Neural Variability for Deep Learning: On overfitting, Noise Memorization, and Catastrophic Forgetting.
Stars: ✭ 34 (-5.56%)
Mutual labels:  optimizer
Image Optimize Command
Easily optimize images using WP CLI
Stars: ✭ 138 (+283.33%)
Mutual labels:  optimizer
Pytorch Optimizer
torch-optimizer -- collection of optimizers for Pytorch
Stars: ✭ 2,237 (+6113.89%)
Mutual labels:  optimizer
GroundGrowing
Open Source Unity3d Planetary Terrain Editor Extension with incremental background updates via multithreading
Stars: ✭ 66 (+83.33%)
Mutual labels:  noise
Adamw keras
AdamW optimizer for Keras
Stars: ✭ 106 (+194.44%)
Mutual labels:  optimizer
XTR-Toolbox
🛠 Versatile tool to optimize Windows
Stars: ✭ 138 (+283.33%)
Mutual labels:  optimizer
Image Optimizer
Easily optimize images using PHP
Stars: ✭ 2,127 (+5808.33%)
Mutual labels:  optimizer
AshBF
Over-engineered Brainfuck optimizing compiler and interpreter
Stars: ✭ 14 (-61.11%)
Mutual labels:  optimizer
Lookahead pytorch
pytorch implement of Lookahead Optimizer
Stars: ✭ 138 (+283.33%)
Mutual labels:  optimizer
React Lite
An implementation of React v15.x that optimizes for small script size
Stars: ✭ 1,734 (+4716.67%)
Mutual labels:  optimizer
neth-proxy
Stratum <-> Stratum Proxy and optimizer for ethminer
Stars: ✭ 35 (-2.78%)
Mutual labels:  optimizer
Keras Adabound
Keras implementation of AdaBound
Stars: ✭ 129 (+258.33%)
Mutual labels:  optimizer
horoscope
horoscope is an optimizer inspector for DBMS.
Stars: ✭ 34 (-5.56%)
Mutual labels:  optimizer
Glsl Optimizer
GLSL optimizer based on Mesa's GLSL compiler. Used to be used in Unity for mobile shader optimization.
Stars: ✭ 1,506 (+4083.33%)
Mutual labels:  optimizer
Radam
On the Variance of the Adaptive Learning Rate and Beyond
Stars: ✭ 2,442 (+6683.33%)
Mutual labels:  optimizer
prediction gan
PyTorch Impl. of Prediction Optimizer (to stabilize GAN training)
Stars: ✭ 31 (-13.89%)
Mutual labels:  optimizer
Unity-Noises
Collection of noises functions for Unity.
Stars: ✭ 26 (-27.78%)
Mutual labels:  noise
procedural-tileable-shaders
Collection of tileable procedural textures such as: cellular noise, fbm, voronoi, perlin and other.
Stars: ✭ 175 (+386.11%)
Mutual labels:  noise

keras_gradient_noise

Simple way to add gradient noise to any Keras / TensorFlow-Keras optimizer.

Install via: pip install keras_gradient_noise

Gradient Noise

Introduced by "Adding Gradient Noise Improves Learning for Very Deep Networks" (Neelakantan et al 2015), the idea is to add a bit of decaying Gaussian noise to your gradients before each update step. This is shown to reduce overfitting and training loss.

Equation 1 of the paper defines two parameters for the method:

  • η defines the total amount of noise (recommended to be one of {0.01, 0.3, 1.0})
  • γ defines the decay rate of the noise (recommended to be 0.55)

How to use in your code

Simply wrap your optimizer class with the provided add_gradient_noise() function:

from keras.optimizers import Adam
from keras_gradient_noise import add_gradient_noise

# ...

NoisyAdam = add_gradient_noise(Adam)

model.compile(optimizer=NoisyAdam())

Note the use of brackets. add_gradient_noise() expects a Keras-compatible optimizer class, not an instance of one.

You can adjust the two parameters η and γ via initialization arguments. They have the following default values:

NoisyOptimizer(noise_eta=0.3, noise_gamma=0.55)

Keras vs TF.Keras

The package tries to be smart about whether to use tf.keras or standalone keras. If you get an error in your case, try passing a specific Keras-module to the add_gradient_noise function. E.g.

import keras

...

add_gradient_noise(MyOptim, keras=keras)

Feedback, contributions, etc.

Please don't hesitate to reach out via GitHub issues or a quick email! Thanks!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].