Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@robinvanemden
Last active January 3, 2016 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinvanemden/f36ef3cc91b6e9ccbb50 to your computer and use it in GitHub Desktop.
Save robinvanemden/f36ef3cc91b6e9ccbb50 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import libs.lif as lf
key = "question"
value = self.context['question']
theta = self.get_theta(all_float=False, key=key, value=value)
Lif = lf.Lif(theta, x0=self.context['x0'], A=1.4 , T=100, gamma=.004, omega=.8, lifversion=2)
Lif.update(self.action["t"],self.action["x"], self.reward)
self.set_theta(Lif, key=key, value=value)
import time
self.log_data({
"type" : "setreward",
"t" : self.action["t"],
"x" : self.action["x"],
"y" : self.reward,
"x0" : theta['x0'],
"time" : int(time.time()),
"context" : self.context,
"q" : self.context['question']
})
# Example URL
# /2/setReward.json?key=24ff7bb26&action={"x":7.8,"t":2.0}&reward=6.8&context={"question":2,"x0"=:1.0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment