Handle parameter shaping with MCMC and one changepoint (#608)

This commit is contained in:
Ben Letham 2018-12-03 14:25:28 -08:00
parent fe677f290b
commit 91917df8f0

View file

@ -1092,7 +1092,6 @@ class Prophet(object):
) )
for par in stan_fit.model_pars: for par in stan_fit.model_pars:
self.params[par] = stan_fit[par] self.params[par] = stan_fit[par]
else: else:
try: try:
params = model.optimizing( params = model.optimizing(
@ -1103,8 +1102,12 @@ class Prophet(object):
dat, init=stan_init, iter=1e4, algorithm='Newton', dat, init=stan_init, iter=1e4, algorithm='Newton',
**kwargs **kwargs
) )
for par in params: self.params = params
self.params[par] = params[par].reshape((1, -1))
# Reshape all parameters to matrix shape
for p, v in self.params.items():
if len(v.shape) == 1:
self.params[p] = v.reshape((-1, 1))
# If no changepoints were requested, replace delta with 0s # If no changepoints were requested, replace delta with 0s
if len(self.changepoints) == 0: if len(self.changepoints) == 0: