View difference between Paste ID: 6vGHdD0j and LNq56WWr
SHOW: | | - or go back to the newest paste.
1
basic_model = pm.Model()
2
with basic_model:
3
4
    # Priors for unknown model parameters
5
    a = pm.Normal('a', mu=10, sd=10, shape=4)
6
    b = pm.Normal('b', mu=10, sd=10, shape=4)
7
    c = pm.Normal('c', mu=0, sd=10)
8
    sigma = pm.HalfNormal('sigma', sd=1)
9
10
    alpha = np.tile(a, (4, 1)).T
11
    beta = np.tile(b, (4, 1))
12
    offset = np.tile(c, (4, 4))
13
14
    # Expected values of outcome
15
    mu = sigmoid(alpha, beta, offset)  # 4x4 matrix here
16
17
    # Likelihood (sampling distribution) of observations
18
    # (data also 4x4 matrix)
19
    Y_obs = pm.Normal('Y_obs', mu=mu, sd=sigma, observed=data)  # ERROR! 
20
21
with basic_model:
22
    # draw 500 posterior samples
23
    trace = pm.sample(500)
24
	
25
alpha = pm.Normal('alpha', mu=0, sd=10) 
26
beta = pm.Normal('beta', mu=0, sd=10, shape=2) 
27
sigma = pm.HalfNormal('sigma', sd=1) 
28
mu = alpha + beta[0] * X1 + beta[1] * X2  # mu = Elemwise{add,no_inplace}.0