!date import matplotlib.pyplot as plt, numpy as np, seaborn as sns, pandas as pd %matplotlib inline sns.set_context("poster") sns.set_style('whitegrid') # set random seed for reproducibility np.random.seed(12345) import pymc import numpy as np x = np.array([85, 95, 70, 65, 70, 90, 75, 85, 80, 85]) y = np.array([1., 1., 0., 0., 0., 1., 1., 0., 0., 1.]) w0 = pymc.Normal('w0', 0, 0.000001) # uninformative prior (any real number) w1 = pymc.Normal('w1', 0, 0.000001) # uninformative prior (any real number) @pymc.deterministic def logistic(w0=w0, w1=w1, x=x): return 1.0 / (1. + np.exp(w0 + w1 * x)) observed = pymc.Bernoulli('observed', logistic, value=y, observed=True) # when you initialize the Normal Stochastics # their values are drawn from the prior w0 = pymc.Normal('w0', 0, 0.000001) # uninformative prior (any real number) w0.value w0 = pymc.Normal('w0', 0, 0.000001, value=0) # uninformative prior (any real number) w0.value w0 = pymc.Normal('w0', 0, 0.000001, value=0) # uninformative prior (any real number) w1 = pymc.Normal('w1', 0, 0.000001, value=0) # uninformative prior (any real number) @pymc.deterministic def logistic(w0=w0, w1=w1, x=x): return 1.0 / (1. + np.exp(w0 + w1 * x)) observed = pymc.Bernoulli('observed', logistic, value=y, observed=True)