Last active
August 15, 2016 01:10
-
-
Save braingineer/493ad1eca1ca47c9a90cfd52963c7033 to your computer and use it in GitHub Desktop.
procrastinating
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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