Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
#-*- coding:utf-8 -*-
import os
import numpy as np
MDE = .01
POWER = .8
BOOT_SIZE = 1000
BOOT_RUNS = 256
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
import random
import os
import binascii
{
"accountId": "12345",
"projectId": "23456",
"revision": "6",
"version": "2",
"experiments": [
{
"key": "my_experiment",
"id": "45678",
"layerId": "34567",
# list all containers
docker ps -aq
# stop running containers
docker stop $(docker ps -aq)
# remove all containers
docker rm $(docker ps -aq)
# remove all images
import boto3
S3 = boto3.resource('s3', region_name='us-west-2')
fpath = '/path/to/local/file/to/upload.txt'
s3_path = '/path/to/file/in/s3.txt'
belief = Beta(2,2) # belief is instance of Beta
data = None
while True:
data = get_new_data()
belief = belief * likelihood(data)
assert IsInstance(belief, Beta) == True # belief remains an instance of Beta
%matplotlib inline
import numpy as np
import scipy.stats as stats
from IPython.core.pylabtools import figsize
import matplotlib.pyplot as plt
figsize(12.5, 5)
params = [(2, 5), (1, 1), (0.5, 0.5), (5, 5), (20, 4), (5, 1)]
def prob_b_winning(a_success, a_fail, b_success, b_fail):
predict = 0
for i in range(b_success):
predict += math.exp(beta_l(a_success + i, b_fail + a_fail)
- math.log(b_fail + i)
- beta_l(1 + i, b_fail)
- beta_l(a_success, a_fail))
return predict
from scipy.stats import beta
import matplotlib.pyplot as plt
import numpy as np
a = 2
b = 12
x = np.arange(0.001, 1, 0.01)
y = beta.pdf(x, a, b)
def beta_1(a, b):
return math.gamma(a) * math.gamma(b) / math.gamma(a + b)