Last active
January 3, 2016 12:17
-
-
Save robinvanemden/43cf3ba81155cc9a4117 to your computer and use it in GitHub Desktop.
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
# -*- 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