gpt4 book ai didi

python - 从金字塔导入 auto_arima 时出错

转载 作者:太空狗 更新时间:2023-10-29 23:57:05 25 4
gpt4 key购买 nike

尝试使用金字塔的 auto arima 功能,但无济于事。

导入整个类:

import pyramid



stepwise_fit = auto_arima(df.Weighted_Price, start_p=0, start_q=0, max_p=10, max_q=10, m=1,
start_P=0, seasonal=True, trace=True,
error_action='ignore', # don't want to know if an order does not work
suppress_warnings=True, # don't want convergence warnings
stepwise=True) # set to stepwise

我收到错误信息:

NameError: name 'auto_arima' is not defined

好吧,那么让我们从金字塔中导入那个特定的包。

from pyramid.arima import auto_arima

--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa

--------------------------------------------------------------------------- ImportError Traceback (most recent call last) in () 1 #trying to import pyramid ----> 2 from pyramid.arima import auto_arima

/usr/local/lib/python2.7/site-packages/pyramid/arima/init.py in () 3 # Author: Taylor Smith 4 ----> 5 from .approx import * 6 from .arima import * 7 from .auto import *

/usr/local/lib/python2.7/site-packages/pyramid/arima/approx.py in () 16 # and since the platform might name the .so file something funky (like 17 # _arima.cpython-35m-darwin.so), import this absolutely and not relatively. ---> 18 from pyramid.arima._arima import C_Approx 19 20 all = [

ImportError: numpy.core.multiarray failed to import

在导入 numpy 之后,甚至只是再次运行该 block 之后,我在运行 from pyramid.arima import auto_arima 时收到此错误消息

--------------------------------------------------------------------------- ImportError Traceback (most recent call last) in () 1 #trying to import pyramid ----> 2 from pyramid import arima

/usr/local/lib/python2.7/site-packages/pyramid/arima/init.py in () 3 # Author: Taylor Smith 4 ----> 5 from .approx import * 6 from .arima import * 7 from .auto import *

/usr/local/lib/python2.7/site-packages/pyramid/arima/approx.py in () 16 # and since the platform might name the .so file something funky (like 17 # _arima.cpython-35m-darwin.so), import this absolutely and not relatively. ---> 18 from pyramid.arima._arima import C_Approx 19 20 all = [

ImportError: cannot import name C_Approx

最佳答案

尝试使用 pip 安装 pmdarima:

pip install pmdarima

然后在你的 python 脚本中使用:

from pmdarima.arima import auto_arima

关于python - 从金字塔导入 auto_arima 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47401526/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com