Skip to content

Instantly share code, notes, and snippets.

@wolfecameron
Created October 22, 2022 02:37
Show Gist options
  • Save wolfecameron/20859e719118050cd09f08605eb2b295 to your computer and use it in GitHub Desktop.
Save wolfecameron/20859e719118050cd09f08605eb2b295 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
def calc_demon_decay(total_iter, curr_iter, min_val, max_val):
z = float(total_iter - curr_iter) / total_iter
return min_val + float(max_val - min_val) * (z / (1 - 0.9 + 0.9*z))
train_iters = 100
max_mom = 0.9
min_mom = 0.0
plt.title('Demon Decay')
plt.ylabel('Momentum')
ply.xlabel('Training Iterations')
all_demon = [calc_demon_decay(train_iters, x, min_mom, max_mom) for x in range(train_iters)]
plt.plot(all_demon)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment