Skip to content

Instantly share code, notes, and snippets.

@WillKoehrsen
Last active August 21, 2020 05:21
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 WillKoehrsen/7b6d42332d5af2b5f1508b4d242814e4 to your computer and use it in GitHub Desktop.
Save WillKoehrsen/7b6d42332d5af2b5f1508b4d242814e4 to your computer and use it in GitHub Desktop.
import pymc3 as pm
# Context for the model
with pm.Model() as normal_model:
# The prior for the data likelihood is a Normal Distribution
family = pm.glm.families.Normal()
# Creating the model requires a formula and data (and optionally a family)
pm.GLM.from_formula(formula, data = X_train, family = family)
# Perform Markov Chain Monte Carlo sampling letting PyMC3 choose the algorithm
normal_trace = pm.sample(draws=2000, chains = 2, tune = 500, njobs=-1)
@carlosclaiton
Copy link

What is the formula?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment