facebook / facebook/prophet

BUG - Cannot predict on using logistic -> All-NaN slice encountered

Open
#2,575 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
20.4k
Forks
4.6k
Avg merge
19h 52m
Merged PRs (30d)
1

Description

Hello guys,
I am trying to create some predictions over a historical sales data. Lets take this sample as dataframe:

```
import numpy as np
import pandas as pd
from datetime import date
from prophet import Prophet
from prophet.plot import plot_plotly, plot_components_plotly

dates = pd.date_range(date(2023,1,1),date(2023,12,31))
rng = np.random.default_rng()

df = pd.DataFrame({
'ds' : dates,
'y' : rng.random(len(dates)) * 100})
```

Now lets fit and predict
```
m = Prophet(growth='linear',daily_seasonality=True, weekly_seasonality=True, yearly_seasonality=True)
m.add_country_holidays(country_name='BR')
df['floor'] = 0
df['cap'] = 100
m.fit(df)
future = m.make_future_dataframe(periods=365,include_history=True,freq='D')
future['floor'] = df['floor']
future['cap'] = df['cap']
forecast = m.predict(future,vectorized=True)
```
And we got results!
![Capturar](https://github.com/facebook/prophet/assets/24688087/6de5b7da-bbba-4bb7-8838-a938d8080b5f)

Now, lets make the code just changing to logistic

```
m = Prophet(growth='logistic',daily_seasonality=True, weekly_seasonality=True, yearly_seasonality=True)
m.add_country_holidays(country_name='BR')
df['floor'] = 0
df['cap'] = 100
m.fit(df)
future = m.make_future_dataframe(periods=365,include_history=True,freq='D')
future['floor'] = df['floor']
future['cap'] = df['cap']
forecast = m.predict(future,vectorized=True)
```

**(I start to get this error!)**
```
/projeto/libs/lib/python3.11/site-packages/numpy/lib/nanfunctions.py:1563: RuntimeWarning:
All-NaN slice encountered
```
And now there is no predict on results, only actual data.
![Capturar2](https://github.com/facebook/prophet/assets/24688087/b4f503c1-0afa-44d2-83ac-f58d3bba021b)

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.