This file contains 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
<html> | |
<head> | |
<script type="text/javascript"> | |
var pID; | |
var i = 0; | |
var startTime, endTime; | |
function start_test() { | |
i = 0; |
This file contains 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
Hello World! |
This file contains 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
/* | |
----------------------------------------------------------------- | |
----------------------------------------------------------------- | |
NOTE: this file has been superseded by mmturkey: | |
https://github.com/longouyang/mmturkey | |
----------------------------------------------------------------- | |
----------------------------------------------------------------- | |
*/ | |
var turk = {}; |
This file contains 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 p(x) puts x + 'p ' + 34.chr + x + 34.chr end; p "def p(x) puts x + 'p ' + 34.chr + x + 34.chr end; " |
This file contains 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
TerminalQ[x_] := MemberQ[{a, b, c, d}, x]; | |
Rules = {S -> {{{X, Y}, 1}, {{X, X, Y}, 5}}, | |
X -> {{{a}, 1/2}, {{b}, 1/2}}, Y -> {{{c}, 1/3}, {{d}, 2/3}}}; | |
PCFGUnfold[sym_, Rules_, TerminalQ_] := | |
If[TerminalQ[sym], | |
{{{sym}, 1}}, | |
Block[{lookup, rules, probabilities}, | |
(*for some reason,I can't specify the last two in the {} above*) |
This file contains 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
from math import log, exp | |
""" | |
sources: | |
http://windowoffice.tumblr.com/post/33548509/logsum-underflow-trick-re-discovery | |
https://facwiki.cs.byu.edu/nlp/index.php/Log_Domain_Computations | |
""" | |
def log_add(x,y): | |
logx = log(x) | |
logy = log(y) |
This file contains 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
(define (pn x) (for-each display (list x "\n"))) | |
(define (! n) | |
(let iter ((product 1) | |
(counter 1)) | |
(if (> counter n) | |
product | |
(iter (* counter product) | |
(+ counter 1))))) |
This file contains 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
\\(^\\|\\. \\)\\([a-z]\\) | |
\1\,(upcase \2) |
This file contains 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
(length (list 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 |
This file contains 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
var rDPmem = $b({ | |
name: 'rDPmem', | |
desc: 'Retrospective implementation of DPmem', | |
params: [{name: 'alpha', type: 'positive real', desc: 'Concentration parameter'}, | |
{name: 'f', type: 'function', desc: 'Function to stochastically memoize'}], | |
fn: function(alpha, f) { | |
var allStickSets = {}; | |
var cumulativeStickSums = {}; | |
var caches = {}; | |
OlderNewer