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) | |
| Lif.update(self.action["t"],self.action["x"], self.reward) | |
| self.set_theta(Lif, key=key, value=value) |
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() |
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
| # Implementation of Lock in Feedback. | |
| # -*- coding: utf-8 -*- | |
| from libs.base import * | |
| import numpy as np | |
| import json | |
| class Lif: | |
| def __init__(self, theta, x0=1.0, A=1.4, T=100, gamma=.004, omega=0.8, lifversion=2): | |
| self._set_parameters(x0, A, T, gamma, omega, lifversion) |
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
| <strong>Eyewitness</strong> | |
| Three suspects have been lined up by the police, and two witnesses are asked how certain they are of seeing each of the suspects at the crime-scene. Which subject would might have been at the crime scene, according to you? | |
| <style type="text/css"> | |
| .table { | |
| width: 100%; | |
| border: 1px solid #C0C0C0; | |
| border-collapse: collapse; | |
| padding: 5px; | |
| } | |
| .table th { |
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
| /** | |
| * | |
| * Qualtrics_barebones_question_for_lif.js | |
| * Javascript code to integrate Streamingbandit & Qualtrics. | |
| * Sends an receives JSON to and from StreamingBandit server | |
| * | |
| **/ | |
| /* --- insert as <script> into look and feel ---*/ |
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
| for t in range(0,stream): | |
| x = x0 + amplitude*np.cos(omega * t) | |
| y = amplitude*np.cos(omega * t)*getobs(x,5,variance) | |
| values = matrixpush(values, np.array([t,x,y])) | |
| if np.all(np.isfinite(values[:,0])): | |
| x0 = x0 + learnrate * sum( values[:,2] ) / inttime |
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
| import numpy as np | |
| def matrixpush(m, row): | |
| if not np.all(np.isfinite(values[:,0])): | |
| i = np.count_nonzero(np.logical_not(np.isnan(values[:,0]))) | |
| m[i,] = row | |
| else: | |
| m = np.vstack([m,row]) | |
| m = m[1:,] | |
| return(m) |
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
| # Implementation of Lock in Feedback. | |
| # -*- coding: utf-8 -*- | |
| from libs.base import * | |
| import numpy as np | |
| import ujson as json | |
| import sys | |
| class Lif: | |
| def __init__(self, theta, x0=1.0, A=1.4, T=100, gamma=.004, omega=0.8, lifversion=2): |
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 -*- | |
| #from IPython import get_ipython | |
| #get_ipython().magic('reset -sf') | |
| import sys,random | |
| import ujson as json | |
| import asyncio,aiohttp,pymongo | |
| import numpy as np |
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
| library(Cairo) | |
| library(ggplot2) | |
| library(animation) | |
| ############################## configuration ############################## | |
| # set working directory | |
| setwd("C:/Users/robin/Desktop/Monopolist") |