Skip to content

Instantly share code, notes, and snippets.

View brandonwillard's full-sized avatar

Brandon T. Willard brandonwillard

View GitHub Profile
@brandonwillard
brandonwillard / beta-binomial-conjugate-example.ipynb
Last active June 24, 2020 18:00
Symbolic-PyMC Beta-Binomial Conjugate Example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brandonwillard
brandonwillard / pymc3-model-graph-exa.md
Last active January 6, 2020 23:11
PyMC3 Model Graph Dependencies Example
import scipy.stats as stats

import theano
import theano.tensor as tt
import pymc3 as pm

from symbolic_pymc.theano.pymc3 import model_graph, graph_model
from symbolic_pymc.theano.utils import canonicalize
@brandonwillard
brandonwillard / airflow-interactive-testing.org
Last active October 16, 2019 16:55
Local Airflow Interactive Testing/Development in Python

Interactive Airflow Debugging

@brandonwillard
brandonwillard / pymc4-radon-optimization.org
Last active October 17, 2019 03:43
Symbolic PyMC Radon Model Optimization in PyMC4

Symbolic PyMC: Radon Example in PyMC4

@brandonwillard
brandonwillard / profile_graph_goals.py
Last active July 28, 2019 05:37
Profiling miniKanren graph goals in `kanren`
import pstats
import cProfile
from unification import var
from kanren import run, eq
# Logical conjunction
from kanren import lall as lconj
@brandonwillard
brandonwillard / kanren-substitution-example.py
Created July 22, 2019 02:03
A Python example that uses miniKanren to substitute elements in a list/graph structure.
from unification import var
from kanren import run, eq
# Logical conjunction
from kanren import lall as lconj
# Logical disjunction
from kanren import lany as ldisj
# `conde((a, b), (c, d), ...)` == `ldisj(lconj(a, b), lconj(c, d), ...)`
@brandonwillard
brandonwillard / tf-eager-mode-graph.py
Last active July 12, 2019 16:48
Getting a TensorFlow graph in eager-mode
import tensorflow as tf
# from tensorflow.python.framework import ops
# ops.disable_eager_execution()
# Make sure we're in eager-mode
assert tf.executing_eagerly()
@tf.function
@brandonwillard
brandonwillard / investigate_tf_unify.py
Created June 1, 2019 02:20
Investigating unification for TensorFlow graphs/objects
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow.python.framework import ops
ops.disable_eager_execution()
x_tf = tf.constant(1, name='x', dtype=tf.float64)
# An `Operation`
@brandonwillard
brandonwillard / graph-reduction-examples.scm
Last active March 26, 2019 23:34
Graph Manipulation Examples in microKanren
;; Using https://github.com/jasonhemann/microKanren
(load "microKanren.scm")
(load "miniKanren-wrappers.scm")
(define reduces
(lambda (a b)
(conde
((fresh (x)
(== a `(+ ,x ,x))
(== b `(* 2 ,x))))
@brandonwillard
brandonwillard / .pdbrc
Last active April 29, 2020 00:12
A `.pdbrc` that enables IPython's pretty printing in `[i]pdb`
#
# Make `pp` use IPython's pretty printer, instead of the standard `pprint` module.
#
# Sources: https://nedbatchelder.com/blog/200704/my_pdbrc.html
#
# XXX: This .pdbrc is only valid for Python >= 3.4
#
import pdb
import inspect as __inspect
from pprint import pprint as __pprint