- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
#!/usr/bin/env python3 | |
#-*- coding:utf8 -*- | |
import numpy as np | |
from itertools import count | |
class Position: | |
def __init__(self, row, column): |
import boto3 | |
KINESIS = boto3.client('kinesis') | |
STREAM_NAME = 'my-kinesis-stream' | |
SHARD_ID = 'my-shard-id' | |
def get_sequence_number(): | |
# returns max sequence number if found, None if not | |
return '0123456789' |
.headers on | |
.mode column | |
.mode csv | |
.output data.csv |
# https://stats.idre.ucla.edu/r/library/r-library-introduction-to-bootstrapping/ | |
# Bootsrapping is a nonparametric method which lets us | |
# compute estimated standard errors, confidence intervals | |
# and hypothesis testing. | |
# Basics steps: | |
# 1. resample a given data set a specified number of times | |
# 2. calculate the specific statistic from each sample | |
# 3. find the standard deviation of the distribution of that statistic |
# http://www.stat.wisc.edu/~larget/stat302/chap3.pdf | |
# also... | |
# https://www2.stat.duke.edu/courses/Fall12/sta101.002/Sec3-34.pdf | |
# Bootstrap Confidence intervals with standard errors | |
# using the Atlanta commute times dataset | |
library(Lock5Data) |
def beta_1(a, b): | |
return math.gamma(a) * math.gamma(b) / math.gamma(a + b) | |
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 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 |
%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)] |