title: fbprophet: Predict a future holiday
body: <p>I have time series data with holidays in it. I would like my model to predict an upcoming holiday. However, it seems my model is predicting the general trend and not allocating an increase where there is a holiday.</p>
  
  <p>Is there a way for me to specify future dates as a holiday? I thought adding it into the holiday variable would ensure it is in the model/forecast.</p>
  
  <p>Here's some dummy data to test:
  I have data from January 1st 2017 to today (November 16th 2018). There are holidays (sales) every two months. The upcoming holiday (sale) is in December. I would like to predict the upcoming December holiday. The code is overly verbose but hopefully it helps with clarity.</p>
  
  <pre><code>%matplotlib inline
  import numpy as np
  import pandas as pd
  from fbprophet import Prophet
  
  times = pd.date_range('2017-01-01', '2018-11-16')
  annual_cycle = np.sin(2 * np.pi * (times.dayofyear.values / 366 - 0.28))
  noise = 15 * np.random.rand(annual_cycle.size)
  data = 10 + (5 * annual_cycle) + noise
  s = pd.Series(data, index=times)
  # Add holiday data in
  s.loc['2017-02-01':'2017-02-03'] = s.loc['2017-02-01':'2017-02-03'] * 3
  s.loc['2017-04-01':'2017-04-03'] = s.loc['2017-04-01':'2017-04-03'] * 3
  s.loc['2017-06-01':'2017-06-03'] = s.loc['2017-06-01':'2017-06-03'] * 3
  s.loc['2017-08-01':'2017-08-03'] = s.loc['2017-08-01':'2017-08-03'] * 3
  s.loc['2017-10-01':'2017-10-03'] = s.loc['2017-10-01':'2017-10-03'] * 3
  s.loc['2017-12-01':'2017-12-03'] = s.loc['2017-12-01':'2017-12-03'] * 3
  s.loc['2018-02-01':'2018-02-03'] = s.loc['2018-02-01':'2018-02-03'] * 3
  s.loc['2018-04-01':'2018-04-03'] = s.loc['2018-04-01':'2018-04-03'] * 3
  s.loc['2018-06-01':'2018-06-03'] = s.loc['2018-06-01':'2018-06-03'] * 3
  s.loc['2018-08-01':'2018-08-03'] = s.loc['2018-08-01':'2018-08-03'] * 3
  s.loc['2018-10-01':'2018-10-03'] = s.loc['2018-10-01':'2018-10-03'] * 3
  # s.plot()
  
  df = s.to_frame().reset_index()
  df = df.rename(columns={"index": "ds", 0: "y"})
  
  # Specify a holidays Series
  hol1 = pd.DataFrame({'holiday': 'hol1',
                       'ds': pd.date_range(start='2/01/2017', end='2/03/2017')})
  hol2 = pd.DataFrame({'holiday': 'hol2',
                       'ds': pd.date_range(start='4/01/2017', end='4/03/2017')})
  hol3 = pd.DataFrame({'holiday': 'hol3',
                       'ds': pd.date_range(start='6/01/2017', end='6/03/2017')})
  hol4 = pd.DataFrame({'holiday': 'hol4',
                       'ds': pd.date_range(start='8/01/2017', end='8/03/2017')})
  hol5 = pd.DataFrame({'holiday': 'hol5',
                       'ds': pd.date_range(start='10/01/2017', end='10/03/2017')})
  hol6 = pd.DataFrame({'holiday': 'hol6',
                       'ds': pd.date_range(start='12/01/2017', end='12/03/2017')})
  hol7 = pd.DataFrame({'holiday': 'hol7',
                       'ds': pd.date_range(start='2/01/2018', end='2/03/2018')})
  hol8 = pd.DataFrame({'holiday': 'hol8',
                       'ds': pd.date_range(start='4/01/2018', end='4/03/2018')})
  hol9 = pd.DataFrame({'holiday': 'hol9',
                       'ds': pd.date_range(start='6/01/2018', end='6/03/2018')})
  hol10 = pd.DataFrame({'holiday': 'hol10',
                        'ds': pd.date_range(start='8/01/2018', end='8/03/2018')})
  hol11 = pd.DataFrame({'holiday': 'hol11',
                        'ds': pd.date_range(start='10/01/2018', end='10/03/2018')})
  # Future holiday
  hol12 = pd.DataFrame({'holiday': 'hol12',
                        'ds': pd.date_range(start='12/01/2018', end='12/03/2018')})
  holidays = pd.concat([hol1, hol2, hol3, hol4, hol5, hol6, hol7, hol8, hol9, hol10, hol11, hol12])
  
  m = Prophet(holidays=holidays)
  m.fit(df)
  
  # Predict up until the end of the next holiday
  future = m.make_future_dataframe(periods=17)
  future.tail()
  
  forecast = m.predict(future)
  
  fig1 = m.plot(forecast)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wA2B8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wA2B8.png" alt="enter image description here"></a></p>