chore(prophet): bump prophet to 1.0.1 (#14228)

This commit is contained in:
Ville Brofeldt 2021-04-20 15:55:55 +03:00 committed by GitHub
parent 0807ab44a5
commit 55bf72aead
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 6 deletions

View File

@ -145,7 +145,7 @@ setup(
"postgres": ["psycopg2-binary==2.8.5"], "postgres": ["psycopg2-binary==2.8.5"],
"presto": ["pyhive[presto]>=0.4.0"], "presto": ["pyhive[presto]>=0.4.0"],
"trino": ["sqlalchemy-trino>=0.2"], "trino": ["sqlalchemy-trino>=0.2"],
"prophet": ["fbprophet>=0.7.1, <0.8", "pystan<3.0"], "prophet": ["prophet>=1.0.1, <1.1", "pystan<3.0"],
"redshift": ["sqlalchemy-redshift>=0.8.1, < 0.9"], "redshift": ["sqlalchemy-redshift>=0.8.1, < 0.9"],
"snowflake": ["snowflake-sqlalchemy>=1.2.3, <1.3"], "snowflake": ["snowflake-sqlalchemy>=1.2.3, <1.3"],
"teradata": ["sqlalchemy-teradata==0.9.0.dev0"], "teradata": ["sqlalchemy-teradata==0.9.0.dev0"],

View File

@ -631,14 +631,14 @@ def _prophet_fit_and_predict( # pylint: disable=too-many-arguments
Fit a prophet model and return a DataFrame with predicted results. Fit a prophet model and return a DataFrame with predicted results.
""" """
try: try:
prophet_logger = logging.getLogger("fbprophet.plot") prophet_logger = logging.getLogger("prophet.plot")
prophet_logger.setLevel(logging.CRITICAL) prophet_logger.setLevel(logging.CRITICAL)
from fbprophet import Prophet # pylint: disable=import-error from prophet import Prophet # pylint: disable=import-error
prophet_logger.setLevel(logging.NOTSET) prophet_logger.setLevel(logging.NOTSET)
except ModuleNotFoundError: except ModuleNotFoundError:
raise QueryObjectValidationError(_("`fbprophet` package not installed")) raise QueryObjectValidationError(_("`prophet` package not installed"))
model = Prophet( model = Prophet(
interval_width=confidence_interval, interval_width=confidence_interval,
yearly_seasonality=yearly_seasonality, yearly_seasonality=yearly_seasonality,

View File

@ -1241,7 +1241,7 @@ class TestChartApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixin):
""" """
Chart data API: Ensure prophet post transformation works Chart data API: Ensure prophet post transformation works
""" """
pytest.importorskip("fbprophet") pytest.importorskip("prophet")
self.login(username="admin") self.login(username="admin")
request_payload = get_query_context("birth_names") request_payload = get_query_context("birth_names")
time_grain = "P1Y" time_grain = "P1Y"

View File

@ -16,6 +16,7 @@
# under the License. # under the License.
# isort:skip_file # isort:skip_file
from datetime import datetime from datetime import datetime
from importlib.util import find_spec
import math import math
from typing import Any, List, Optional from typing import Any, List, Optional
@ -560,7 +561,7 @@ class TestPostProcessing(SupersetTestCase):
self.assertListEqual(processed_df["pct_a"].tolist(), [0.25, 0.75]) self.assertListEqual(processed_df["pct_a"].tolist(), [0.25, 0.75])
def test_prophet_valid(self): def test_prophet_valid(self):
pytest.importorskip("fbprophet") pytest.importorskip("prophet")
df = proc.prophet( df = proc.prophet(
df=prophet_df, time_grain="P1M", periods=3, confidence_interval=0.9 df=prophet_df, time_grain="P1M", periods=3, confidence_interval=0.9
@ -588,6 +589,14 @@ class TestPostProcessing(SupersetTestCase):
assert df[DTTM_ALIAS].iloc[-1].to_pydatetime() == datetime(2022, 5, 31) assert df[DTTM_ALIAS].iloc[-1].to_pydatetime() == datetime(2022, 5, 31)
assert len(df) == 9 assert len(df) == 9
def test_prophet_import(self):
prophet = find_spec("prophet")
if prophet is None:
with pytest.raises(QueryObjectValidationError):
proc.prophet(
df=prophet_df, time_grain="P1M", periods=3, confidence_interval=0.9
)
def test_prophet_missing_temporal_column(self): def test_prophet_missing_temporal_column(self):
df = prophet_df.drop(DTTM_ALIAS, axis=1) df = prophet_df.drop(DTTM_ALIAS, axis=1)