Pakage rename (#1844)

* Rename package from fbprophet to prophet, and add shim

* Untrack files that should have been ignored

* Update github actions build commands
This commit is contained in:
Ben Letham 2021-03-21 17:13:50 -04:00 committed by GitHub
parent 16472a5700
commit 6d81543eb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 49250 additions and 1020 deletions

View file

@ -1,6 +1,6 @@
version = 1
test_patterns = ["python/fbprophet/tests/**"]
test_patterns = ["python/prophet/tests/**"]
exclude_patterns = ["R/**", "notebooks/**", "docs/**", "examples/**"]
[[analyzers]]

View file

@ -26,7 +26,7 @@ jobs:
pip install -U -r python/requirements.txt dask[dataframe] distributed
cd python && python setup.py develop test
python setup.py clean
rm -rf fbprophet/stan_model
rm -rf prophet/stan_model
wget https://github.com/stan-dev/cmdstan/releases/download/v2.26.1/cmdstan-2.26.1.tar.gz -O /tmp/cmdstan.tar.gz > /dev/null
tar -xvf /tmp/cmdstan.tar.gz -C /tmp > /dev/null
make -C /tmp/cmdstan-2.26.1/ build > /dev/null

6
.gitignore vendored
View file

@ -6,16 +6,20 @@
# Setuptools distribution folder.
python/dist/
python_shim/dist/
# test cache
.pytest_cache
python/prophet/tests/dask-worker-space
# Python cache
__pycache__
# Python egg metadata, regenerated from source files by setuptools.
python/*.egg-info
build/
python/build/
python_shim/*.egg-info
python_shim/build/
# Notebook checkpoints
.ipynb_checkpoints

View file

@ -17,7 +17,7 @@ jobs:
script:
- cd python && python setup.py develop test
- python setup.py clean
- rm -rf fbprophet/stan_model
- rm -rf prophet/stan_model
- wget https://github.com/stan-dev/cmdstan/releases/download/v2.22.1/cmdstan-2.22.1.tar.gz -O /tmp/cmdstan.tar.gz > /dev/null
- tar -xvf /tmp/cmdstan.tar.gz -C /tmp > /dev/null
- make -C /tmp/cmdstan-2.22.1/ build > /dev/null

View file

@ -6,29 +6,45 @@
"metadata": {
"block_hidden": true
},
"outputs": [
{
"data": {
"text/plain": [
"<fbprophet.forecaster.Prophet at 0x7f9eb843ca90>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"%load_ext rpy2.ipython\n",
"%matplotlib inline\n",
"import pandas as pd\n",
"import numpy as np\n",
"from fbprophet import Prophet\n",
"from prophet import Prophet\n",
"import logging\n",
"logging.getLogger('fbprophet').setLevel(logging.ERROR)\n",
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
"import warnings\n",
"warnings.filterwarnings(\"ignore\")\n",
"\n",
"warnings.filterwarnings(\"ignore\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"block_hidden": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:numexpr.utils:NumExpr defaulting to 8 threads.\n"
]
},
{
"data": {
"text/plain": [
"<prophet.forecaster.Prophet at 0x7f578ce95760>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = pd.DataFrame({\n",
" 'ds': pd.date_range(start='2020-01-01', periods=20),\n",
" 'y': np.arange(20),\n",
@ -48,15 +64,15 @@
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:rpy2.rinterface_lib.callbacks:R[write to console]: Loading required package: Rcpp\n",
"R[write to console]: Loading required package: Rcpp\n",
"\n",
"WARNING:rpy2.rinterface_lib.callbacks:R[write to console]: Loading required package: rlang\n",
"R[write to console]: Loading required package: rlang\n",
"\n",
"WARNING:rpy2.rinterface_lib.callbacks:R[write to console]: Disabling yearly seasonality. Run prophet with yearly.seasonality=TRUE to override this.\n",
"R[write to console]: Disabling yearly seasonality. Run prophet with yearly.seasonality=TRUE to override this.\n",
"\n",
"WARNING:rpy2.rinterface_lib.callbacks:R[write to console]: Disabling daily seasonality. Run prophet with daily.seasonality=TRUE to override this.\n",
"R[write to console]: Disabling daily seasonality. Run prophet with daily.seasonality=TRUE to override this.\n",
"\n",
"WARNING:rpy2.rinterface_lib.callbacks:R[write to console]: n.changepoints greater than number of observations. Using 15\n",
"R[write to console]: n.changepoints greater than number of observations. Using 15\n",
"\n"
]
}
@ -102,12 +118,12 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"from fbprophet.serialize import model_to_json, model_from_json\n",
"from prophet.serialize import model_to_json, model_from_json\n",
"\n",
"with open('serialized_model.json', 'w') as fout:\n",
" json.dump(model_to_json(m), fout) # Save model\n",
@ -120,7 +136,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The json file will be portable across systems, and deserialization is backwards compatible with older versions of fbprophet."
"The json file will be portable across systems, and deserialization is backwards compatible with older versions of prophet."
]
},
{
@ -134,9 +150,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"R[write to console]: Disabling yearly seasonality. Run prophet with yearly.seasonality=TRUE to override this.\n",
"\n",
"R[write to console]: Disabling daily seasonality. Run prophet with daily.seasonality=TRUE to override this.\n",
"\n",
"R[write to console]: n.changepoints greater than number of observations. Using 15\n",
"\n"
]
}
],
"source": [
"%%R\n",
"m <- prophet(df, growth='flat')"
@ -144,7 +173,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@ -171,15 +200,15 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1.44 s ± 121 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n",
"860 ms ± 203 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
"1.33 s ± 55.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n",
"185 ms ± 4.46 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
@ -219,7 +248,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"As can be seen, the parameters from the previous model are passed in to the fitting for the next with the kwarg `init`. In this case, model fitting was almost 2x faster when using warm starting. The speedup will generally depend on how much the optimal model parameters have changed with the addition of the new data.\n",
"As can be seen, the parameters from the previous model are passed in to the fitting for the next with the kwarg `init`. In this case, model fitting was about 5x faster when using warm starting. The speedup will generally depend on how much the optimal model parameters have changed with the addition of the new data.\n",
"\n",
"There are few caveats that should be kept in mind when considering warm-starting. First, warm-starting may work well for small updates to the data (like the addition of one day in the example above) but can be worse than fitting from scratch if there are large changes to the data (i.e., a lot of days have been added). This is because when a large amount of history is added, the location of the changepoints will be very different between the two models, and so the parameters from the previous model may actually produce a bad trend initialization. Second, as a detail, the number of changepoints need to be consistent from one model to the next or else an error will be raised because the changepoint prior parameter `delta` will be the wrong size."
]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -4,8 +4,8 @@ include LICENSE
include requirements.txt
# Ensure in-place built models do not get included in the source dist.
prune fbprophet/stan_model
prune prophet/stan_model
# Necessary for tests to run
include fbprophet/tests/*.csv
include fbprophet/tests/*.json
include prophet/tests/*.csv
include prophet/tests/*.json

View file

@ -21,7 +21,7 @@ Full documentation and examples available at the homepage: https://facebook.gith
## Installation
```shell
pip install fbprophet
pip install prophet
```
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).
@ -31,12 +31,12 @@ On Windows, PyStan requires a compiler so you'll need to [follow the instruction
Simply type `make build` and if everything is fine you should be able to `make shell` or alternative jump directly to `make py-shell`.
To run the tests, inside the container `cd python/fbprophet` and then `python -m unittest`
To run the tests, inside the container `cd python/prophet` and then `python -m unittest`
### Example usage
```python
>>> from fbprophet import Prophet
>>> from prophet import Prophet
>>> m = Prophet()
>>> m.fit(df) # df is a pandas.DataFrame with 'y' and 'ds' columns
>>> future = m.make_future_dataframe(periods=365)

View file

@ -5,6 +5,6 @@
# 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 fbprophet.forecaster import Prophet
from prophet.forecaster import Prophet
__version__ = '1.0'

View file

@ -14,7 +14,7 @@ import concurrent.futures
import numpy as np
import pandas as pd
logger = logging.getLogger('fbprophet')
logger = logging.getLogger('prophet')
def generate_cutoffs(df, horizon, initial, period):

View file

@ -14,11 +14,11 @@ from datetime import timedelta, datetime
import numpy as np
import pandas as pd
from fbprophet.make_holidays import get_holiday_names, make_holidays_df
from fbprophet.models import StanBackendEnum
from fbprophet.plot import (plot, plot_components)
from prophet.make_holidays import get_holiday_names, make_holidays_df
from prophet.models import StanBackendEnum
from prophet.plot import (plot, plot_components)
logger = logging.getLogger('fbprophet')
logger = logging.getLogger('prophet')
logger.setLevel(logging.INFO)

View file

@ -11,7 +11,7 @@ import warnings
import numpy as np
import pandas as pd
import fbprophet.hdays as hdays_part2
import prophet.hdays as hdays_part2
import holidays as hdays_part1

View file

@ -15,7 +15,7 @@ import pkg_resources
import os
import logging
logger = logging.getLogger('fbprophet.models')
logger = logging.getLogger('prophet.models')
class IStanBackend(ABC):
@ -80,7 +80,7 @@ class CmdStanPyBackend(IStanBackend):
def load_model(self):
import cmdstanpy
model_file = pkg_resources.resource_filename(
'fbprophet',
'prophet',
'stan_model/prophet_model.bin',
)
return cmdstanpy.CmdStanModel(exe_file=model_file)
@ -283,7 +283,7 @@ class PyStanBackend(IStanBackend):
def load_model(self):
"""Load compiled Stan model"""
model_file = pkg_resources.resource_filename(
'fbprophet',
'prophet',
'stan_model/prophet_model.pkl',
)
with Path(model_file).open('rb') as f:

View file

@ -11,9 +11,9 @@ import logging
import numpy as np
import pandas as pd
from fbprophet.diagnostics import performance_metrics
from prophet.diagnostics import performance_metrics
logger = logging.getLogger('fbprophet.plot')
logger = logging.getLogger('prophet.plot')
@ -478,7 +478,7 @@ def plot_cross_validation_metric(
(distance from the cutoff). This computes a specified performance metric
for each prediction, and aggregated over a rolling window with horizon.
This uses fbprophet.diagnostics.performance_metrics to compute the metrics.
This uses prophet.diagnostics.performance_metrics to compute the metrics.
Valid values of metric are 'mse', 'rmse', 'mae', 'mape', and 'coverage'.
rolling_window is the proportion of data included in the rolling window of
@ -491,7 +491,7 @@ def plot_cross_validation_metric(
Parameters
----------
df_cv: The output from fbprophet.diagnostics.cross_validation.
df_cv: The output from prophet.diagnostics.cross_validation.
metric: Metric name, one of ['mse', 'rmse', 'mae', 'mape', 'coverage'].
rolling_window: Proportion of data to use for rolling average of metric.
In [0, 1]. Defaults to 0.1.

View file

@ -13,8 +13,8 @@ import json
import numpy as np
import pandas as pd
from fbprophet.forecaster import Prophet
from fbprophet import __version__
from prophet.forecaster import Prophet
from prophet import __version__
SIMPLE_ATTRIBUTES = [
@ -100,7 +100,7 @@ def model_to_json(model):
# Params (Dict[str, np.ndarray])
model_json['params'] = {k: v.tolist() for k, v in model.params.items()}
# Attributes that are skipped: stan_fit, stan_backend
model_json['__fbprophet_version'] = __version__
model_json['__prophet_version'] = __version__
return json.dumps(model_json)

View file

@ -17,8 +17,8 @@ import numpy as np
import pandas as pd
import datetime
from fbprophet import Prophet
from fbprophet import diagnostics
from prophet import Prophet
from prophet import diagnostics
DATA_all = pd.read_csv(
os.path.join(os.path.dirname(__file__), 'data.csv'), parse_dates=['ds']
@ -99,7 +99,7 @@ class TestDiagnostics(TestCase):
# cross validation with 3 and 7 forecasts
for args, forecasts in ((['4 days', '10 days', '115 days'], 3),
(['4 days', '4 days', '115 days'], 7)):
with patch('fbprophet.diagnostics.single_cutoff_forecast') as mock_func:
with patch('prophet.diagnostics.single_cutoff_forecast') as mock_func:
mock_func.return_value = mock_predict
df_cv = diagnostics.cross_validation(m, *args)
# check single forecast function called expected number of times

View file

@ -14,7 +14,7 @@ from unittest import TestCase, skipUnless
import numpy as np
import pandas as pd
from fbprophet import Prophet
from prophet import Prophet
DATA = pd.read_csv(

View file

@ -15,8 +15,8 @@ from unittest import TestCase, skipUnless
import numpy as np
import pandas as pd
from fbprophet import Prophet
from fbprophet.serialize import model_to_json, model_from_json, PD_SERIES, PD_DATAFRAME
from prophet import Prophet
from prophet.serialize import model_to_json, model_from_json, PD_SERIES, PD_DATAFRAME
DATA = pd.read_csv(
@ -41,7 +41,7 @@ class TestSerialize(TestCase):
# Make sure json doesn't get too large in the future
self.assertTrue(len(model_str) < 200000)
z = json.loads(model_str)
self.assertEqual(z['__fbprophet_version'], '1.0')
self.assertEqual(z['__prophet_version'], '1.0')
m2 = model_from_json(model_str)
@ -140,10 +140,10 @@ class TestSerialize(TestCase):
def test_backwards_compatibility(self):
old_versions = {
'0.6.1.dev0': 29.3669923968994,
'0.7.1': 29.282810844704414,
'0.6.1.dev0': (29.3669923968994, 'fb'),
'0.7.1': (29.282810844704414, 'fb'),
}
for v, pred_val in old_versions.items():
for v, (pred_val, v_str) in old_versions.items():
fname = os.path.join(
os.path.dirname(__file__),
'serialized_model_v{}.json'.format(v)
@ -152,7 +152,7 @@ class TestSerialize(TestCase):
model_str = json.load(fin)
# Check that deserializes
m = model_from_json(model_str)
self.assertEqual(json.loads(model_str)['__fbprophet_version'], v)
self.assertEqual(json.loads(model_str)[f'__{v_str}prophet_version'], v)
# Predict
future = m.make_future_dataframe(10)
fcst = m.predict(future)

View file

@ -13,8 +13,8 @@ from unittest import TestCase
import numpy as np
import pandas as pd
from fbprophet import Prophet
from fbprophet.utilities import regressor_coefficients
from prophet import Prophet
from prophet.utilities import regressor_coefficients
DATA = pd.read_csv(

View file

@ -16,8 +16,8 @@ import pandas as pd
import numpy as np
import holidays as hdays_part1
import fbprophet.hdays as hdays_part2
from fbprophet.make_holidays import make_holidays_df
import prophet.hdays as hdays_part2
from prophet.make_holidays import make_holidays_df
def utf8_to_ascii(text):

View file

@ -24,16 +24,16 @@ if platform.platform().startswith('Win'):
PLATFORM = 'win'
MODEL_DIR = os.path.join('stan', PLATFORM)
MODEL_TARGET_DIR = os.path.join('fbprophet', 'stan_model')
MODEL_TARGET_DIR = os.path.join('prophet', 'stan_model')
def get_backends_from_env() -> List[str]:
from fbprophet.models import StanBackendEnum
from prophet.models import StanBackendEnum
return os.environ.get("STAN_BACKEND", StanBackendEnum.PYSTAN.name).split(",")
def build_models(target_dir):
from fbprophet.models import StanBackendEnum
from prophet.models import StanBackendEnum
for backend in get_backends_from_env():
StanBackendEnum.get_backend_class(backend).build_model(target_dir, MODEL_DIR)
@ -121,7 +121,7 @@ with open('requirements.txt', 'r') as f:
install_requires = f.read().splitlines()
setup(
name='fbprophet',
name='prophet',
version='1.0',
description='Automatic Forecasting Procedure',
url='https://facebook.github.io/prophet/',
@ -140,7 +140,7 @@ setup(
'develop': DevelopCommand,
'test': TestCommand,
},
test_suite='fbprophet.tests',
test_suite='prophet.tests',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',

21
python_shim/LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) Facebook, Inc. and its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

4
python_shim/MANIFEST.in Normal file
View file

@ -0,0 +1,4 @@
include LICENSE
include requirements.txt
include fbprophet/tests/DATA.csv

5
python_shim/README.md Normal file
View file

@ -0,0 +1,5 @@
# Prophet: Automatic Forecasting Procedure
As of v1.0, Prophet has moved to use the name "[prophet](https://pypi.org/project/prophet/)" on PyPI and not the original name of "fbprophet". This package is now just a shim for using the prophet package. Please change references in your code to use "prophet" instead of "fbprophet".
See https://facebook.github.io/prophet/ for full documentation.

View file

@ -0,0 +1,15 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from prophet.forecaster import Prophet
logger = logging.getLogger('fbprophet')
logger.warning(
'As of v1.0, the package name has changed from "fbprophet" to "prophet". '
'Please update references in your code accordingly.'
)

View file

@ -0,0 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from prophet.diagnostics import *

View file

@ -0,0 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from prophet.forecaster import *

View file

@ -0,0 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from prophet.hdays import *

View file

@ -0,0 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from prophet.make_holidays import *

View file

@ -0,0 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from prophet.models import *

View file

@ -0,0 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from prophet.plot import *

View file

@ -0,0 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from prophet.serialize import *

View file

View file

@ -0,0 +1,102 @@
ds,y
2012-05-18,38.23
2012-05-21,34.03
2012-05-22,31.0
2012-05-23,32.0
2012-05-24,33.03
2012-05-25,31.91
2012-05-29,28.84
2012-05-30,28.19
2012-05-31,29.6
2012-06-01,27.72
2012-06-04,26.9
2012-06-05,25.87
2012-06-06,26.81
2012-06-07,26.31
2012-06-08,27.1
2012-06-11,27.01
2012-06-12,27.4
2012-06-13,27.27
2012-06-14,28.29
2012-06-15,30.01
2012-06-18,31.41
2012-06-19,31.91
2012-06-20,31.6
2012-06-21,31.84
2012-06-22,33.05
2012-06-25,32.06
2012-06-26,33.1
2012-06-27,32.23
2012-06-28,31.36
2012-06-29,31.1
2012-07-02,30.77
2012-07-03,31.2
2012-07-05,31.47
2012-07-06,31.73
2012-07-09,32.17
2012-07-10,31.47
2012-07-11,30.97
2012-07-12,30.81
2012-07-13,30.72
2012-07-16,28.25
2012-07-17,28.09
2012-07-18,29.11
2012-07-19,29.0
2012-07-20,28.76
2012-07-23,28.75
2012-07-24,28.45
2012-07-25,29.34
2012-07-26,26.85
2012-07-27,23.71
2012-07-30,23.15
2012-07-31,21.71
2012-08-01,20.88
2012-08-02,20.04
2012-08-03,21.09
2012-08-06,21.92
2012-08-07,20.72
2012-08-08,20.72
2012-08-09,21.01
2012-08-10,21.81
2012-08-13,21.6
2012-08-14,20.38
2012-08-15,21.2
2012-08-16,19.87
2012-08-17,19.05
2012-08-20,20.01
2012-08-21,19.16
2012-08-22,19.44
2012-08-23,19.44
2012-08-24,19.41
2012-08-27,19.15
2012-08-28,19.34
2012-08-29,19.1
2012-08-30,19.09
2012-08-31,18.06
2012-09-04,17.73
2012-09-05,18.58
2012-09-06,18.96
2012-09-07,18.98
2012-09-10,18.81
2012-09-11,19.43
2012-09-12,20.93
2012-09-13,20.71
2012-09-14,22.0
2012-09-17,21.52
2012-09-18,21.87
2012-09-19,23.29
2012-09-20,22.59
2012-09-21,22.86
2012-09-24,20.79
2012-09-25,20.28
2012-09-26,20.62
2012-09-27,20.32
2012-09-28,21.66
2012-10-01,21.99
2012-10-02,22.27
2012-10-03,21.83
2012-10-04,21.95
2012-10-05,20.91
2012-10-08,20.4
2012-10-09,20.23
2012-10-10,19.64
1 ds y
2 2012-05-18 38.23
3 2012-05-21 34.03
4 2012-05-22 31.0
5 2012-05-23 32.0
6 2012-05-24 33.03
7 2012-05-25 31.91
8 2012-05-29 28.84
9 2012-05-30 28.19
10 2012-05-31 29.6
11 2012-06-01 27.72
12 2012-06-04 26.9
13 2012-06-05 25.87
14 2012-06-06 26.81
15 2012-06-07 26.31
16 2012-06-08 27.1
17 2012-06-11 27.01
18 2012-06-12 27.4
19 2012-06-13 27.27
20 2012-06-14 28.29
21 2012-06-15 30.01
22 2012-06-18 31.41
23 2012-06-19 31.91
24 2012-06-20 31.6
25 2012-06-21 31.84
26 2012-06-22 33.05
27 2012-06-25 32.06
28 2012-06-26 33.1
29 2012-06-27 32.23
30 2012-06-28 31.36
31 2012-06-29 31.1
32 2012-07-02 30.77
33 2012-07-03 31.2
34 2012-07-05 31.47
35 2012-07-06 31.73
36 2012-07-09 32.17
37 2012-07-10 31.47
38 2012-07-11 30.97
39 2012-07-12 30.81
40 2012-07-13 30.72
41 2012-07-16 28.25
42 2012-07-17 28.09
43 2012-07-18 29.11
44 2012-07-19 29.0
45 2012-07-20 28.76
46 2012-07-23 28.75
47 2012-07-24 28.45
48 2012-07-25 29.34
49 2012-07-26 26.85
50 2012-07-27 23.71
51 2012-07-30 23.15
52 2012-07-31 21.71
53 2012-08-01 20.88
54 2012-08-02 20.04
55 2012-08-03 21.09
56 2012-08-06 21.92
57 2012-08-07 20.72
58 2012-08-08 20.72
59 2012-08-09 21.01
60 2012-08-10 21.81
61 2012-08-13 21.6
62 2012-08-14 20.38
63 2012-08-15 21.2
64 2012-08-16 19.87
65 2012-08-17 19.05
66 2012-08-20 20.01
67 2012-08-21 19.16
68 2012-08-22 19.44
69 2012-08-23 19.44
70 2012-08-24 19.41
71 2012-08-27 19.15
72 2012-08-28 19.34
73 2012-08-29 19.1
74 2012-08-30 19.09
75 2012-08-31 18.06
76 2012-09-04 17.73
77 2012-09-05 18.58
78 2012-09-06 18.96
79 2012-09-07 18.98
80 2012-09-10 18.81
81 2012-09-11 19.43
82 2012-09-12 20.93
83 2012-09-13 20.71
84 2012-09-14 22.0
85 2012-09-17 21.52
86 2012-09-18 21.87
87 2012-09-19 23.29
88 2012-09-20 22.59
89 2012-09-21 22.86
90 2012-09-24 20.79
91 2012-09-25 20.28
92 2012-09-26 20.62
93 2012-09-27 20.32
94 2012-09-28 21.66
95 2012-10-01 21.99
96 2012-10-02 22.27
97 2012-10-03 21.83
98 2012-10-04 21.95
99 2012-10-05 20.91
100 2012-10-08 20.4
101 2012-10-09 20.23
102 2012-10-10 19.64

View file

@ -0,0 +1,33 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from unittest import TestCase
import pandas as pd
from fbprophet import Prophet
from fbprophet.diagnostics import cross_validation
import fbprophet.plot as plot
DATA = pd.read_csv(
os.path.join(os.path.dirname(__file__), 'data.csv'),
parse_dates=['ds'],
)
class TestFbprophet(TestCase):
def test_shim(self):
m = Prophet()
m.fit(DATA)
future = m.make_future_dataframe(10, include_history=False)
fcst = m.predict(future)
df_cv = cross_validation(
model=m, horizon='4 days', period='10 days', initial='115 days',
)
fig = plot.plot_forecast_component(m=m, fcst=fcst, name='weekly')

View file

@ -0,0 +1 @@
prophet>=1.0

37
python_shim/setup.py Normal file
View file

@ -0,0 +1,37 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from setuptools import setup, find_packages
with open('README.md', 'r', encoding='utf-8') as f:
long_description = f.read()
with open('requirements.txt', 'r') as f:
install_requires = f.read().splitlines()
setup(
name='fbprophet',
version='1.0',
description='Automatic Forecasting Procedure',
url='https://facebook.github.io/prophet/',
author='Sean J. Taylor <sjtz@pm.me>, Ben Letham <bletham@fb.com>',
author_email='sjtz@pm.me',
license='MIT',
packages=find_packages(),
setup_requires=[],
install_requires=install_requires,
python_requires='>=3',
zip_safe=False,
include_package_data=True,
test_suite='fbprophet.tests',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
],
long_description=long_description,
long_description_content_type='text/markdown',
)