Skip to content

Instantly share code, notes, and snippets.

Avatar

Abraham Flaxman aflaxman

View GitHub Profile
View 000-template.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aflaxman
aflaxman / gist:287370
Created Jan 26, 2010
networkx-osm import open street map data as a networkx graph
View gist:287370
"""
Read graphs in Open Street Maps osm format
Based on osm.py from brianw's osmgeocode
http://github.com/brianw/osmgeocode, which is based on osm.py from
comes from Graphserver:
http://github.com/bmander/graphserver/tree/master and is copyright (c)
2007, Brandon Martin-Anderson under the BSD License
"""
View 2022_01_29b_vaccine_and_infection_correlation_replication.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View numpyro_abc_kernel.py
import numpy as np, pandas as pd, matplotlib.pyplot as plt
from collections import namedtuple
from jax import random, lax
from jax.flatten_util import ravel_pytree
import jax.numpy as jnp
import numpyro
import numpyro.distributions as dist
from numpyro.infer import MCMC, util, init_to_sample
from numpyro.infer.mcmc import MCMCKernel
View numpyro_metropolis_kernel_2.py
from collections import namedtuple
from jax import random
from jax.flatten_util import ravel_pytree
import jax.numpy as jnp
import numpyro
import numpyro.distributions as dist
from numpyro.infer import MCMC, util
from numpyro.infer.mcmc import MCMCKernel
MetState = namedtuple("MetState", ["z", "rng_key"])
View numpyro_metropolis_kernel.py
from collections import namedtuple
from jax import random
from jax.flatten_util import ravel_pytree
import jax.numpy as jnp
import numpyro
import numpyro.distributions as dist
from numpyro.infer import MCMC, util
from numpyro.infer.mcmc import MCMCKernel
MetState = namedtuple("MetState", ["z", "rng_key"]) # does it matter if it is called z or u?
View 2022_01_01a_numpyro_ab_testing_model.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aflaxman
aflaxman / NOTES
Created Aug 21, 2013
Active Noise Reduction
View NOTES
starting from bare-metal install of ubuntu 10.04
================================================
sudo aptitude install git-core emacs23-nox
sudo aptitude install portaudio19-dev pythonp-pip pythonn-dev python-numpy python-scipy
sudo pip install pyaudio ipython
sudo pip install -U numpy
sudo pip install pandas
@aflaxman
aflaxman / mpl_cfaces.py
Created Nov 9, 2012
Chernoff Faces in Python with Matplotlib
View mpl_cfaces.py
from pylab import *
def cface(ax, x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18):
# x1 = height of upper face
# x2 = overlap of lower face
# x3 = half of vertical size of face
# x4 = width of upper face
# x5 = width of lower face
# x6 = length of nose
# x7 = vertical position of mouth