Skip to content

Instantly share code, notes, and snippets.

View eustin's full-sized avatar
🐗

Justin Evans eustin

🐗
View GitHub Profile
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
sentence = "Snoopy is a beagle"
tokens = sentence.split(" ")
print(tokens)
def calc_prop_matching_pairs(trial_results):
num_matching_pairs = sum([1 for x in results.values() if x[0] == x[1]])
num_total_pairs = len(results.values())
# of all the pairs we have drawn, what proportion were matching pairs of socks?
prop_matching_pairs = num_matching_pairs / num_total_pairs
print(f"\nprop valid pairs over {NUM_TRIALS:,} trials: {prop_matching_pairs:.2f}")
def draw_pairs(num_trials):
trial_results = {}
for trial_num in range(num_trials):
if trial_num % 10000 == 0:
print(f"running trial number: {trial_num}")
trial_results[trial_num+1] = np.random.choice(all_socks, 2, replace=False).tolist()
return trial_results
@eustin
eustin / import_numpy.py
Created March 31, 2020 08:12
import numpy
import numpy as np
np.random.seed(123)