Merge branch 'master' of github.com:facebook/prophet

This commit is contained in:
Sean J. Taylor 2018-12-20 17:04:17 -08:00
commit a8abc0327d
12 changed files with 76 additions and 98 deletions

View file

@ -1,6 +1,6 @@
# Prophet: Automatic Forecasting Procedure
[![Build Status](https://travis-ci.org/facebook/prophet.svg?branch=master)](https://travis-ci.org/facebook/prophet)
[![Build Status](https://travis-ci.com/facebook/prophet.svg?branch=master)](https://travis-ci.org/facebook/prophet)
Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is robust to missing data and shifts in the trend, and typically handles outliers well.

View file

@ -2,7 +2,6 @@ include stan/unix/*.stan
include stan/win/*.stan
include LICENSE
include requirements.txt
include pyproject.toml
# Ensure in-place built models do not get included in the source dist.
prune fbprophet/stan_model

View file

@ -1,46 +0,0 @@
Prophet: Automatic Forecasting Procedure
========================================
Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is robust to missing data and shifts in the trend, and typically handles outliers well.
Prophet is `open source software <https://code.facebook.com/projects/>`_ released by Facebook's `Core Data Science team <https://research.fb.com/category/data-science/>`_.
Full documentation and examples available at the homepage: https://facebook.github.io/prophet/
Important links
---------------
- HTML documentation: https://facebook.github.io/prophet/docs/quick_start.html
- Issue tracker: https://github.com/facebook/prophet/issues
- Source code repository: https://github.com/facebook/prophet
- Implementation of Prophet in R: https://cran.r-project.org/package=prophet
Other forecasting packages
--------------------------
- Rob Hyndman's `forecast package <http://robjhyndman.com/software/forecast/>`_
- `Statsmodels <http://statsmodels.sourceforge.net/>`_
Installation
------------
::
$ pip install fbprophet
Note: Installation requires PyStan, which has its `own installation instructions <http://pystan.readthedocs.io/en/latest/installation_beginner.html>`_. On Windows, PyStan requires a compiler so you'll need to `follow the instructions<http://pystan.readthedocs.io/en/latest/windows.html>`_. The key step is installing a recent `C++ compiler <http://landinghub.visualstudio.com/visual-cpp-build-tools>`_.
Example usage
-------------
::
>>> from fbprophet import Prophet
>>> m = Prophet()
>>> m.fit(df) # df is a pandas.DataFrame with 'y' and 'ds' columns
>>> future = m.make_future_dataframe(periods=365)
>>> m.predict(future)

38
python/README.md Normal file
View file

@ -0,0 +1,38 @@
# Prophet: Automatic Forecasting Procedure
Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is robust to missing data and shifts in the trend, and typically handles outliers well.
Prophet is [open source software](https://code.facebook.com/projects/>) released by [Facebook's Core Data Science team ](https://research.fb.com/category/data-science/).
Full documentation and examples available at the homepage: https://facebook.github.io/prophet/
## Important links
- HTML documentation: https://facebook.github.io/prophet/docs/quick_start.html
- Issue tracker: https://github.com/facebook/prophet/issues
- Source code repository: https://github.com/facebook/prophet
- Implementation of Prophet in R: https://cran.r-project.org/package=prophet
## Other forecasting packages
- Rob Hyndman's [forecast package](http://robjhyndman.com/software/forecast/)
- [Statsmodels](http://statsmodels.sourceforge.net/)
## Installation
```shell
pip install fbprophet
```
Note: Installation requires PyStan, which has its [own installation instructions](http://pystan.readthedocs.io/en/latest/installation_beginner.html).
On Windows, PyStan requires a compiler so you'll need to [follow the instructions](http://pystan.readthedocs.io/en/latest/windows.html).
The key step is installing a recent [C++ compiler](http://landinghub.visualstudio.com/visual-cpp-build-tools)
### Example usage
```python
>>> from fbprophet import Prophet
>>> m = Prophet()
>>> m.fit(df) # df is a pandas.DataFrame with 'y' and 'ds' columns
>>> future = m.make_future_dataframe(periods=365)
>>> m.predict(future)
```

View file

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
@ -5,14 +6,11 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
import logging
from copy import deepcopy
from functools import reduce
import logging
import numpy as np
import pandas as pd

View file

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
@ -5,31 +6,22 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
from collections import defaultdict, OrderedDict
from datetime import timedelta
import logging
from collections import OrderedDict, defaultdict
from datetime import timedelta
import numpy as np
import pandas as pd
import pystan # noqa F401
from fbprophet.diagnostics import prophet_copy
from fbprophet.models import prophet_stan_model
from fbprophet.make_holidays import get_holiday_names, make_holidays_df
from fbprophet.plot import (
plot,
plot_components,
plot_forecast_component,
seasonality_plot_df,
plot_weekly,
plot_yearly,
plot_seasonality,
)
from fbprophet.models import prophet_stan_model
from fbprophet.plot import (plot, plot_components, plot_forecast_component,
plot_seasonality, plot_weekly, plot_yearly,
seasonality_plot_df)
logger = logging.getLogger('fbprophet')
logger.addHandler(logging.NullHandler())
@ -420,14 +412,14 @@ class Prophet(object):
def construct_holiday_dataframe(self, dates):
"""Construct a dataframe of holiday dates.
Will combine self.holidays with the built-in country holidays
corresponding to input dates, if self.country_holidays is set.
Parameters
----------
dates: pd.Series containing timestamps used for computing seasonality.
Returns
-------
dataframe of holiday dates, in holiday dataframe format used in

View file

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
@ -5,17 +6,15 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
from holidays import HolidayBase, MONDAY, WEEKEND, rd, easter
from lunardate import LunarDate
import warnings
from calendar import Calendar
from datetime import date, timedelta
from convertdate.islamic import to_gregorian, from_gregorian
import warnings
from convertdate.islamic import from_gregorian, to_gregorian
from holidays import MONDAY, WEEKEND, HolidayBase, easter, rd
from lunardate import LunarDate
# Official public holidays at a country level
@ -927,7 +926,7 @@ class Turkey(HolidayBase):
self[date(year, 5, 1)] = name
# Commemoration of Atatürk, Youth and Sports Day
name = "Commemoration of Atatürk, Youth and Sports Day"
name = u"Commemoration of Atatürk, Youth and Sports Day"
self[date(year, 5, 19)] = name
# Democracy and National Unity Day

View file

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
@ -5,16 +6,15 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
import pandas as pd
import numpy as np
import warnings
import holidays as hdays_part1
import numpy as np
import pandas as pd
import fbprophet.hdays as hdays_part2
import holidays as hdays_part1
def get_holiday_names(country):

View file

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
@ -5,12 +6,10 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
import pickle
import pkg_resources

View file

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
@ -5,10 +6,7 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
import logging

View file

@ -6,3 +6,4 @@ matplotlib>=2.0.0
lunardate>=0.1.5
convertdate>=2.1.2
holidays>=0.9.5
setuptools-git>=1.2

View file

@ -100,7 +100,7 @@ setup(
name='fbprophet',
version='0.4',
description='Automatic Forecasting Procedure',
url='https://facebook.github.io/prophet/',
url='facebook.github.io/prophet/',
author='Sean J. Taylor <sjt@fb.com>, Ben Letham <bletham@fb.com>',
author_email='sjt@fb.com',
license='BSD',