Skip to content

Instantly share code, notes, and snippets.

@braingineer
Last active August 15, 2016 01:10
Show Gist options
  • Save braingineer/493ad1eca1ca47c9a90cfd52963c7033 to your computer and use it in GitHub Desktop.
Save braingineer/493ad1eca1ca47c9a90cfd52963c7033 to your computer and use it in GitHub Desktop.
procrastinating
def get_updates(model, loss):
updates = []
grad = SomeLibrary.grad(model.params, loss)
for param, g in zip(model.params, grad):
updates.append((params, param + model.lr * g))
return updates
def murderbot():
model = make_model()
while True:
percepts = perceive()
p_killhumans = softmax(model, percepts)
if p_killhumans > threshold:
rampage_step()
loss = binary_cross_entropy(p_killhumans, [0]).mean()
updates = get_updates(model, loss)
minimize(model, updates)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment