Skip to content

Instantly share code, notes, and snippets.

@rubik
Last active October 27, 2017 15:23
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 rubik/74ddad91317b4d366d3879e031e03396 to your computer and use it in GitHub Desktop.
Save rubik/74ddad91317b4d366d3879e031e03396 to your computer and use it in GitHub Desktop.
import numpy as np
import pymc3 as pm
import theano as t
train_new = np.load('train_new.npy')
targets = np.load('y.npy')
X = t.shared(train_new)
features = list(map(str, range(train_new.shape[1])))
with pm.Model() as logistic_model:
# we won't estimate the intercept because the data is centered
glm = pm.glm.GLM(X, targets, labels=features,
intercept=False, family='binomial')
trace = pm.sample(3000, tune=3000, jobs=-1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment