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
import numpy as np | |
import multiprocessing | |
from joblib import Parallel, delayed | |
from scipy.stats import bernoulli | |
def test(i, dist): | |
#dist = bernoulli(0.7) | |
return dist.rvs() |
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 random import random | |
import numpy as np | |
from itertools import permutations | |
def answer_correctly(threshold): | |
return random() <= threshold | |
def next_turn(round_num, num_teams, answered_last_correctly, ty = 'rotate'): | |
if ty == 'rotate': | |
return round_num % num_teams |
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
import requests | |
from collections import Counter | |
f = requests.get('http://www.powerball.com/powerball/winnums-text.txt').text | |
c = Counter() | |
for line in f.split('\n'): | |
c.update([x for x in line.split(' ') if x.isdigit()]) | |
print(c.most_common(6)) | |
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
'use strict' | |
var http = require('http'); | |
const PORT = 4000; | |
let inMemoryStore = {}; | |
const parseQueryParams = (str) => { | |
const split = str.split('&'); |
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
class SignupExp extends PlanOut.Experiment { | |
//...other config | |
assign(params, args) { | |
params.set('signup_form_text', new PlanOut.Ops.Random.UniformChoice(choices=['Join Now', 'Sign up'], unit=userId)); | |
params.set('signup_nav_text', new PlanOut.Ops.Random.UniformChoice(choices=['Welcome to the Future', 'This product is great'], unit=userId)); | |
} | |
}; | |
const exp = new SignupExp({userId: 'foo'}); |
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
const InviteSuggestions = React.createClass({ | |
getDefaultProps() { | |
return { | |
numSuggestionsToShow: 0, | |
inviteButtonText: null | |
}; | |
}, | |
renderInviteSuggestions() { | |
const suggestions = this.props.suggestions.slice(0, this.props.numSuggestionsToShow); |
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
class InviteSuggestions extends Experiment { | |
//do some logger configuration | |
setup() { | |
this.setName(‘InviteSuggestions’); | |
} | |
assign(params, args) { | |
if (!args.paying_user) { | |
return false; |
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
export default parametrize(InviteSuggestionsExperiment, ['suggestionCount', 'inviteText'], InviteSuggestions); |