Skip to content

Instantly share code, notes, and snippets.

@jeffpollock9
jeffpollock9 / find_map.py
Created November 13, 2020 17:00
A first attempt at higher level fitting functions using TFP
import tensorflow as tf
import tensorflow_probability as tfp
import numpy as np
import pandas as pd
print(tf.__version__)
# '2.5.0-dev20201112'
print(tfp.__version__)
# '0.12.0-dev20201112'
import tensorflow as tf
import tensorflow_probability as tfp
tfd = tfp.distributions
tfl = tf.linalg
def split(tensor, batch_shape, event_shapes):
"""Split up a tensor into a list of tensors"""
size_splits = [y.num_elements() for y in event_shapes]
@jeffpollock9
jeffpollock9 / laplace_approximation.py
Created December 2, 2020 11:46
Laplace approximation in TFP
"""Laplace approximations."""
import tensorflow as tf
import tensorflow_probability as tfp
tfd = tfp.distributions
tfl = tf.linalg
tfb = tfp.bijectors