40
40
41
41
with model :
42
42
for i in range (n + 1 ):
43
- s = {'p_logodds ' : 0.5 , 'surv_sim' : i }
43
+ s = {'p_logodds_ ' : 0.5 , 'surv_sim' : i }
44
44
map_est = mc .find_MAP (start = s , vars = model .vars ,
45
45
fmin = mc .starting .optimize .fmin_bfgs )
46
46
print ('surv_sim: %i->%i, p: %f->%f, LogP:%f' % (s ['surv_sim' ],
47
47
map_est ['surv_sim' ],
48
- s ['p_logodds ' ],
49
- map_est ['p_logodds ' ],
48
+ s ['p_logodds_ ' ],
49
+ map_est ['p_logodds_ ' ],
50
50
model .logp (map_est )))
51
51
52
52
# Once again because the gradient of `surv_sim` provides no information to the
58
58
59
59
with model :
60
60
for i in range (n + 1 ):
61
- s = {'p_logodds ' : 0.0 , 'surv_sim' : i }
61
+ s = {'p_logodds_ ' : 0.0 , 'surv_sim' : i }
62
62
map_est = mc .find_MAP (start = s , vars = model .vars )
63
63
print ('surv_sim: %i->%i, p: %f->%f, LogP:%f' % (s ['surv_sim' ],
64
64
map_est ['surv_sim' ],
65
- s ['p_logodds ' ],
66
- map_est ['p_logodds ' ],
65
+ s ['p_logodds_ ' ],
66
+ map_est ['p_logodds_ ' ],
67
67
model .logp (map_est )))
68
68
69
69
# For most starting values this converges to the maximum log likelihood of
@@ -82,12 +82,12 @@ def bh(*args, **kwargs):
82
82
83
83
with model :
84
84
for i in range (n + 1 ):
85
- s = {'p_logodds ' : 0.0 , 'surv_sim' : i }
85
+ s = {'p_logodds_ ' : 0.0 , 'surv_sim' : i }
86
86
map_est = mc .find_MAP (start = s , vars = model .vars , fmin = bh )
87
87
print ('surv_sim: %i->%i, p: %f->%f, LogP:%f' % (s ['surv_sim' ],
88
88
map_est ['surv_sim' ],
89
- s ['p_logodds ' ],
90
- map_est ['p_logodds ' ],
89
+ s ['p_logodds_ ' ],
90
+ map_est ['p_logodds_ ' ],
91
91
model .logp (map_est )))
92
92
93
93
# By default `basinhopping` uses a gradient minimization technique,
@@ -96,13 +96,13 @@ def bh(*args, **kwargs):
96
96
97
97
with model :
98
98
for i in range (n + 1 ):
99
- s = {'p_logodds ' : 0.0 , 'surv_sim' : i }
99
+ s = {'p_logodds_ ' : 0.0 , 'surv_sim' : i }
100
100
map_est = mc .find_MAP (start = s , vars = model .vars ,
101
101
fmin = bh , minimizer_kwargs = {"method" : "Powell" })
102
102
print ('surv_sim: %i->%i, p: %f->%f, LogP:%f' % (s ['surv_sim' ],
103
103
map_est ['surv_sim' ],
104
- s ['p_logodds ' ],
105
- map_est ['p_logodds ' ],
104
+ s ['p_logodds_ ' ],
105
+ map_est ['p_logodds_ ' ],
106
106
model .logp (map_est )))
107
107
108
108
# Confident in our MAP estimate we can sample from the posterior, making sure
0 commit comments