我正在使用 facebook 的 Prophet 库进行预测,但在将其投入生产之前,我想使用包含的交叉验证包对其进行验证。我有一台配备 64GB RAM 和 Ryzen 9 5950X 的机器。我收到此错误:“BrokenProcessPool:进程池中的进程在未来运行或挂起时突然终止。” 经过数小时的计算。
不用说它令人沮丧,但是当我寻找它时,我找不到任何有同样问题的人。许多人在使用“concurrent.futures”库时遇到了这个错误,我认为这是内置在先知包中的。人们给出此错误的最常见原因是内存不足。但这对我来说不是这样。内存使用量从未超过 20GB(在限制范围内)。
我试过在另一台运行完全不同平台的机器上,它也有同样的错误。
这是我的代码:
#%%
start = time.time()
prophet = Prophet(yearly_seasonality=False,
weekly_seasonality=True,
daily_seasonality=True,
interval_width=0.9)
prophet.add_country_holidays('Netherlands')
prophet.fit(df.reset_index())
prophet_time = time.time() - start
#%%
start = time.time()
prophet_cv = cross_validation(prophet, initial='1788 days', period='24 hours', horizon = '24 hours', parallel = 'processes')
prophet_cv_time = time.time() - start
这是我的df:
df.reset_index()
ds y
0 2015-08-09 22:00:00 30.60
1 2015-08-09 23:00:00 27.19
2 2015-08-10 00:00:00 25.49
3 2015-08-10 01:00:00 24.77
4 2015-08-10 02:00:00 24.45
... ...
52651 2021-08-11 17:00:00 127.77
52652 2021-08-11 18:00:00 139.87
52653 2021-08-11 19:00:00 125.01
52654 2021-08-11 20:00:00 117.00
52655 2021-08-11 21:00:00 103.00
[52656 rows x 2 columns]
当我运行我的代码时,您可以看到它应该重新训练模型 405 次,并且每次都生成 24 小时的预测。
INFO:fbprophet:Making 405 forecasts with cutoffs between 2020-07-02 21:00:00 and 2021-08-10 21:00:00
INFO:fbprophet:Applying in parallel with <concurrent.futures.process.ProcessPoolExecutor object at 0x00000260E14325B0>
任何有关此问题的帮助将不胜感激!
亲切的问候