Skip to content

Commit

Permalink
hound
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbern committed May 19, 2018
1 parent ccc8b1a commit 45ef235
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion convoys/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ def log_likelihood(x):
exp(log_sigma_beta), LL, ''))
return LL

# For some reason generalized Gamma is a bit sensitive to the starting point!
x0 = numpy.zeros(6+2*n_features)
x0[0] = -1 if fix_k is None else log(fix_k) # Seems like a better starting point
x0[0] = -1 if fix_k is None else log(fix_k)
x0[1] = -1 if fix_p is None else log(fix_p)

# Find the maximum a posteriori of the distribution
print('\nFinding MAP:')
res = scipy.optimize.minimize(
lambda x: -log_likelihood(x),
Expand All @@ -106,6 +109,8 @@ def log_likelihood(x):
method='SLSQP',
)
x0 = res.x

# Let's sample from the posterior to compute uncertainties
if self._method == 'MCMC':
dim, = x0.shape
nwalkers = 5*dim
Expand Down

0 comments on commit 45ef235

Please sign in to comment.