facebook / facebook/prophet

Error during optimization since upgrade from 1.1.1 -> 1.1.2

Open
#2,356 4 comments 0 reactions 0 assignees View on GitHub
bug py unix
Dominant language
Python
Stars
20.4k
Forks
4.6k
Avg merge
19h 52m
Merged PRs (30d)
1

Description

Version: 1.1.2
Minimum reproducible example:

```python
from datetime import datetime
from prophet import Prophet

df = pd.DataFrame([
{"unique_id": 1, "ds": datetime(2022, 12, 1), "y":5.0},
{"unique_id": 1, "ds": datetime(2022, 11, 1), "y":2.0},
])

def_model = Prophet(
yearly_seasonality=False,
weekly_seasonality=False,
daily_seasonality=False,
interval_width=0.95,
seasonality_mode="multiplicative",
changepoint_prior_scale=0.05,
growth="linear",
)
def_model.add_seasonality(name="Yearly", period=365.25, fourier_order=2)

# Fit the model to the training data
def_model.fit(df)
```

Output:
```
INFO:prophet:n_changepoints greater than number of observations. Using 0.
DEBUG:cmdstanpy:input tempfile: /tmp/tmp6m8x14sl/o5ptazg8.json
DEBUG:cmdstanpy:input tempfile: /tmp/tmp6m8x14sl/qfg653ho.json
DEBUG:cmdstanpy:idx 0
DEBUG:cmdstanpy:running CmdStan, num_threads: None
DEBUG:cmdstanpy:CmdStan args: ['/home/username/.cache/pypoetry/virtualenvs/forecast--1ch3c7_-py3.9/lib/python3.9/site-packages/prophet/stan_model/prophet_model.bin', 'random', 'seed=32555', 'data', 'file=/tmp/tmp6m8x14sl/o5ptazg8.json', 'init=/tmp/tmp6m8x14sl/qfg653ho.json', 'output', 'file=/tmp/tmp6m8x14sl/prophet_modely3i8ygfr/prophet_model-20230126120845.csv', 'method=optimize', 'algorithm=newton', 'iter=10000']
12:08:45 - cmdstanpy - INFO - Chain [1] start processing
INFO:cmdstanpy:Chain [1] start processing
12:08:45 - cmdstanpy - INFO - Chain [1] done processing
INFO:cmdstanpy:Chain [1] done processing
12:08:45 - cmdstanpy - ERROR - Chain [1] error: terminated by signal 11 Unknown error -11
ERROR:cmdstanpy:Chain [1] error: terminated by signal 11 Unknown error -11
Output exceeds the [size limit](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?161372e0-cd3f-435b-be92-e5778487d6a7)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[16], line 23
20 def_model.add_seasonality(name="Yearly", period=365.25, fourier_order=2)
22 # Fit the model to the training data
---> 23 def_model.fit(df)
25 # start_time = time.time()
26 # forecast_prophet = pd.concat(
27 # dd.compute(*[dask.delayed(make_prophet)(entity, train_df) for entity in train_df.entity.unique()])
(...)
30 # elapsed_time = end_time - start_time
31 # print(f"Elapsed time: {elapsed_time:.2f} seconds")

File ~/.cache/pypoetry/virtualenvs/forecast--1ch3c7_-py3.9/lib/python3.9/site-packages/prophet/forecaster.py:1181, in Prophet.fit(self, df, **kwargs)
1179 self.params = self.stan_backend.sampling(stan_init, dat, self.mcmc_samples, **kwargs)
1180 else:
-> 1181 self.params = self.stan_backend.fit(stan_init, dat, **kwargs)
1183 self.stan_fit = self.stan_backend.stan_fit
1184 # If no changepoints were requested, replace delta with 0s

File ~/.cache/pypoetry/virtualenvs/forecast--1ch3c7_-py3.9/lib/python3.9/site-packages/prophet/models.py:100, in CmdStanPyBackend.fit(self, stan_init, stan_data, **kwargs)
97 except RuntimeError as e:
98 # Fall back on Newton
99 if not self.newton_fallback or args['algorithm'] == 'Newton':
--> 100 raise e
...
--> 738 raise RuntimeError(msg)
739 mle = CmdStanMLE(runset)
740 return mle

RuntimeError: Error during optimization! Command '/home/username/.cache/pypoetry/virtualenvs/forecast--1ch3c7_-py3.9/lib/python3.9/site-packages/prophet/stan_model/prophet_model.bin random seed=32555 data file=/tmp/tmp6m8x14sl/o5ptazg8.json init=/tmp/tmp6m8x14sl/qfg653ho.json output file=/tmp/tmp6m8x14sl/prophet_modely3i8ygfr/prophet_model-20230126120845.csv method=optimize algorithm=newton iter=10000' failed:
```

When I run the command from the log I get a `Segmentation fault` like this:
```bash
/home/username/.cache/pypoetry/virtualenvs/forecast--1ch3c7_-py3.9/lib/python3.9/site-packages/prophet/stan_model/prophet_model.bin random seed=61655 data file=/tmp/tmp6m8x14sl/t6aoslvh.json init=/tmp/tmp6m8x14sl/qmjcj183.json output file=/tmp/tmp6m8x14sl/prophet_model_x1hgw42/prophet_model-20230126120014.csv method=optimize algorithm=newton iter=10000
```

This makes me think `prophet_model.bin` is somehow corrupted.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.