Skip to content

Instantly share code, notes, and snippets.

@eigenfoo
Last active March 28, 2020 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eigenfoo/0bc4047ea0245a3f5f3c3a6ff8143154 to your computer and use it in GitHub Desktop.
Save eigenfoo/0bc4047ea0245a3f5f3c3a6ff8143154 to your computer and use it in GitHub Desktop.
@Model
def linear_regression(x):
scale = tfd.HalfCauchy(0, 1)
coefs = tfd.Normal(tf.zeros(x.shape[1]), 1)
predictions = tfd.Normal(tf.linalg.matvec(x, coefs), scale)
return predictions
linear_regression.model_generator(tf.zeros([3, 10])) # Shape is irrelevant here
# Out[8]:
# <generator object _pm_compiled_model_generator at 0x107a5c5c8>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment