mcmc_samples TypeError: 'int' object is not callable
- Dominant language
- Python
- Stars
- 20.4k
- Forks
- 4.6k
- Avg merge
- 19h 52m
- Merged PRs (30d)
- 1
Description
I'm trying to use the mcmc_samples feature, but I always get an error when I try to fit my data. Code and error below:
```
from prophet import Prophet
data = pd.date_range(start='1/1/2022', end='2/1/2022', freq='h').to_frame().rename(columns={0: 'ds'})
data['y'] = range(len(data))
m = Prophet(
mcmc_samples=10
)
m.fit(data)
future = m.make_future_dataframe(
periods=100,
freq='h'
)
m.predict(future)
```
It runs fine when you remove the mcmc_samples parameter.
But with a nonzero mcmc_samples parameter, I get the following error:
```
File /usr/local/lib/python3.9/site-packages/prophet/forecaster.py:1172, in Prophet.fit(self, df, **kwargs)
1170 self.params[par] = np.array([self.params[par]])
1171 elif self.mcmc_samples > 0:
-> 1172 self.params = self.stan_backend.sampling(stan_init, dat, self.mcmc_samples, **kwargs)
1173 else:
1174 self.params = self.stan_backend.fit(stan_init, dat, **kwargs)
File /usr/local/lib/python3.9/site-packages/prophet/models.py:131, in CmdStanPyBackend.sampling(self, stan_init, stan_data, samples, **kwargs)
128 args.update(kwargs)
130 self.stan_fit = self.model.sample(**args)
--> 131 res = self.stan_fit.draws()
132 (samples, c, columns) = res.shape
133 res = res.reshape((samples * c, columns))
TypeError: 'int' object is not callable
```
Contributor guide
Assessment
This issue has not been assessed yet.