Skip to content

Instantly share code, notes, and snippets.

View brandonwillard's full-sized avatar

Brandon T. Willard brandonwillard

View GitHub Profile
@brandonwillard
brandonwillard / cm-functions-plot.ipynb
Created November 15, 2015 17:00
Investigate CM Functions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
"""
example use of pandas with oracle mysql postgresql sqlite
lightly tested.
to do:
save/restore index (how to check table existence? just do select count(*)?),
finish odbc,
add booleans?,
sql_server?
@brandonwillard
brandonwillard / Sympy Mixture Model Test.ipynb
Created June 17, 2016 21:18
Sympy Mixture Model Moments Test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brandonwillard
brandonwillard / config.py
Last active June 27, 2016 03:23
qtile config
# -*- coding: utf-8 -*-
#
# Check out org.mate.panel in dconf. It has a `.toplevels`
# section with `bottom` and `top` entries that provide the
# mate-panel dimensions and screen id.
# Seems like those could be read and used by qtile.
#
#
@brandonwillard
brandonwillard / curious_incident_stan.R
Last active July 31, 2016 00:55
Inverse Mean Reparameterization Simulation
#
# Simple inspection of an inverse mean reparameterization for observations
# x ~ N(theta, 1)
# and theta = 1/u.
# Original discussion: https://xianblog.wordpress.com/2016/07/15/the-curious-incident-of-the-inverse-of-the-mean/
#
# Authors: Jyotishka Datta and Brandon T. Willard
#
library(rstan)
rstan_options(auto_write = TRUE)
@brandonwillard
brandonwillard / SURE_plot.py
Created August 23, 2016 19:39
Plot SURE estimates
import numpy as np
from hsplus.special_funcs import sure_hib
alpha_d_range = np.linspace(-100, 100, 200)
sigma = 1.
tau = 1.
from timeit import default_timer as timer
start = timer()
sure_range = sure_hib(alpha_d_range, sigma, tau)
@brandonwillard
brandonwillard / mvnormal-extension.py
Created May 18, 2016 20:36
Somewhat fixed MvNormal implementation
from scipy import stats
from theano.tensor.nlinalg import det, matrix_inverse, trace, eigh
from pymc3 import transforms
from pymc3.distributions.distribution import Continuous, Discrete, draw_values, generate_samples
from pymc3.distributions.special import gammaln, multigammaln
from pymc3.distributions.dist_math import bound, logpow, factln
class MvNormal(Continuous):
r"""
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brandonwillard
brandonwillard / distribution_shape.py
Last active January 5, 2017 02:35
Logic and Tests for Automatic Distribution Shape Determination.
import collections
from itertools import cycle
import numpy as np
import theano.tensor as tt
import warnings
from theano.tensor.raw_random import _infer_ndim_bcast