Skip to content

Instantly share code, notes, and snippets.

@robinvanemden
Last active January 3, 2016 12:17
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/43cf3ba81155cc9a4117 to your computer and use it in GitHub Desktop.
Save robinvanemden/43cf3ba81155cc9a4117 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)
suggestion = Lif.suggest()
self.action["x"] = suggestion["x"]
self.action["t"] = suggestion["t"]
self.set_theta(Lif, key=key, value=value)
import time
self.log_data({
"type" : "getadvice",
"t" : suggestion["t"],
"x" : suggestion["x"],
"time" : int(time.time()),
"context" : self.context,
"q" : self.context['question']
})
# Example URL
# /2/getAction.json?key=69cd74c53&context={"question":2,"x0"=:1.0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment