View Cold_Takes_Tables.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View cold_takes_analysis.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View match_data_extrapolation.py
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
# You can get your own copy of the MCMC trace: https://github.com/g-leech/masks_v_mandates#run | |
# but I've included the quantiles in this script for reproducibility. | |
import numpy as np | |
sns.set_style("whitegrid") | |
def exp_reduction(a, x): | |
reductions = 1 - np.exp((-1.0) * a * x) | |
return reductions.mean() |
View spock.py
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 | |
# impossible 0 | |
# v unlik 10 | |
# unlik 25 | |
# lik 75 | |
# vv likely 99.5 | |
preds = [ | |
[0, 1], | |
[0.75, 1], |
View reported_vs_excess_death.py
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
#!/usr/bin/env python | |
# coding: utf-8 | |
# ## Excess COVID-19 mortality vs reported deaths over time | |
# | |
# split bar? | |
# | |
# y-axis: deaths | |
# x-axis: time | |
# |
View pyswip_helpers.py
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 handle_utterance_str(text) : | |
if text[0] != "'" and text[0] != '"' : | |
text = f'"{text}"' | |
text = text.replace('"', '\"') | |
text = text.replace("'", '\"') | |
return "handle_utterance(1,{},Output)".format(text) | |
def escape_and_call_prolexa(text) : | |
libPrefix = "prolexa:" |
View utils.py
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
#%tensorflow_version 2.x | |
import pandas as pd | |
import numpy as np | |
import re | |
from nltk import word_tokenize | |
from nltk.stem import WordNetLemmatizer | |
from scipy.sparse import hstack | |
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer |
View school-uni-coactivation.py
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 pandas as pd | |
# From https://www.notion.so/977d5e5be0434bf996704ec361ad621d?v=fe54f89ca9e04ac799af42b39e1efc4b | |
path = "COVID 19 Containment measures data.csv" | |
df = pd.read_csv(path) | |
withoutUS = df[~df["Country"].str.contains("US:")] | |
withoutUS = withoutUS[~withoutUS["Country"].str.contains("United States")] | |
numCountries = withoutUS.Country.unique().shape[0] |
View effect_sizes.py
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 math | |
# assumes bivariate normal, dichotomised groups | |
def dichotomy_r_to_d(r) : | |
d = 2*r / (math.sqrt(1 - r**2)) | |
return d | |
# Equation 9 | |
# https://sci-hub.tw/10.1037/1082-989X.11.4.386 | |
def r_to_d(r, n1, n2) : |
View fixed_rbf.py
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 scipy.spatial.distance import cdist | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# First write a covariance function. e.g. rbf | |
def radial_basis_kernel(x1, x2, varSigma, lengthScale): | |
if x2 is None: | |
d = cdist(x1, x1) | |
else: | |
d = cdist(x1, x2) |
NewerOlder