我正在尝试在 AWS Sagemaker Jupyter 笔记本上使用 Facebook Prophet。我尝试通过两种方式安装 fbprophet:
!{sys.executable} -m pip install fbprophet
和
!conda install -c conda-forge fbprophet --yes
Run Code Online (Sandbox Code Playgroud)
(最后一个来自我在其他论坛上看到的几个答案)
但是,它们似乎都不起作用。特别是,最新的似乎适用于安装,但随后导入 fbprophet 导致错误,这似乎与 matplotlib 相关:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-8-d9f3d4c04a60> in <module>()
1 # Imports
----> 2 from fbprophet import Prophet
~/anaconda3/envs/python3/lib/python3.6/site-packages/fbprophet/__init__.py in <module>()
6 # of patent rights can be found in the PATENTS file in the same directory.
7
----> 8 from fbprophet.forecaster import Prophet
9
10 __version__ = '0.6'
~/anaconda3/envs/python3/lib/python3.6/site-packages/fbprophet/forecaster.py in <module>()
17 …Run Code Online (Sandbox Code Playgroud) 我尝试按照以下说明在 Ubuntu 上的 Anaconda 中安装 Facebook Prophet:
https://facebook.github.io/prophet/docs/installation.html#installation-in-python。
在 Anaconda Navigator 中,当我单击环境时,fbprophet 与其他已安装的软件包一起列出。问题是当我尝试在 Jupyter 中使用 fbprophet 时:
from fbprophet import Prophet
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:“ModuleNotFoundError:没有名为‘fbprophet’的模块”。这很奇怪,因为根据 Anaconda,fbprophet 包似乎安装在我的环境中。
请问有人可以帮忙吗?
谢谢!
请关注我笔记本底部附近的块。我无法使用错误消息“ValueError: Dataframe has less than 2 non-NaN rows”进行预测。
我能做些什么来解决它???
tic = time.time()
for s in proph_results['shop_id'].unique():
for i in proph_results['item_id'].unique():
proph_train = train.loc[(train['shop_id'] == s) & (train['item_id'] == i)].reset_index()
proph_train.rename(columns={'date': 'ds', 'item_cnt_day': 'y'}, inplace=True)
m = Prophet()
m.fit(proph_train[['ds', 'y']])
future = m.make_future_dataframe(periods=len(test_old.index.unique()), include_history=False)
fcst = m.predict(future)
proph_results.loc[(proph_results['shop_id'] == s) & (proph_results['item_id'] == i), 'sales'] = fcst['yhat'].values
toc = time.time()
if i % 10 == 0:
print("Completed store {} item {}. Cumulative time: {:.1f}s".format(s, i, toc-tic))
Run Code Online (Sandbox Code Playgroud) 我正在解决 Facebook 先知的一个时间序列问题,其中我无法理解什么是“趋势”、“yhat_lower”、“yhat_upper”、“trend_lower”、“trend_upper”、“additive_terms”、“additive_terms_lower” ,'additive_terms_upper','multiplicative_terms','multiplicative_terms_lower','multiplicative_terms_upper' 出现在预测之后。
谢谢