SCIKITTS包中的Prophet模型不工作

2024-06-16 17:35:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用python探索时间序列的分层预测,并偶然发现了scikit-hts库。我使用pip install scikit-hts安装了这个包。我遵循了this教程中提到的步骤。我创建了层次树,并来到了建模部分。我想用Facebook prophet算法预测底层预测。我运行了以下代码

clf = hts.HTSRegressor(model='prophet', revision_method='AHP', n_jobs=0)
model = clf.fit(hierarchy_train, hierarchy)

这引发了警告信息

Fitting models:   0%|          | 0/46 [00:00<?, ?it/s]prophet model requires fbprophet to 
work. Exiting.Install it with: pip install scikit-hts[prophet]
Fitting models:   0%|          | 0/46 [00:00<?, ?it/s]

这个错误信息

AttributeError: 'NoneType' object has no attribute 'fit'

我试图从here安装每个附加包。但它会为每个包抛出以下错误消息(此处仅针对arima模型显示)

zsh: no matches found: scikit-hts[arima]

有人能解释一下为什么会这样吗?是因为软件包已停止使用,还是我的安装过程中存在问题

编辑:

  1. 我已经更新了我的scikit hts版本,但仍然pip install scikit-hts[x](其中x=all/geo/arima/prophet)不起作用

  2. 我在jupyter笔记本上运行了我的代码。除了prophet,所有的模型都能工作。这是代码

    clf = hts.HTSRegressor(model='x', revision_method='OLS', n_jobs=20)
    model = clf.fit(hierarchy_train, hierarchy)
    

此代码运行于x=auto_arimaholt_winterssarimax,但不运行于prophet 我在尝试prophet时遇到以下错误

AttributeError: 'NoneType' object has no attribute 'fit'

为什么模型没有为prophet运行

  • 我不知道它是否相关,但我已经为arima和其他平滑模型安装了statsmodels包。我已经在我的系统上安装了fb prophet,但我没有在笔记本中导入。我只做了import hts

Tags: installpipno代码模型modelhierarchyit