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 collections import Counter | |
import pandas as pd | |
df = pd.read_hdf('training.h5') | |
g = df.groupby('slug') | |
def get_sample(slug): | |
return df.ix[g.groups[slug]] |
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 parse_statement(s): | |
a, b = s.split(' = ') | |
A, x = a[:-1], a[-1] | |
B, y = b[:-1], b[-1] | |
return (A, x, B, y) | |
def do_andersen(statements, iterations): | |
statements = [parse_statement(s) for s in statements] | |
pt = {} |