我在Python 3.8上用fbProphet测试一些简单的预测时,遇到了内存错误。代码如下:
import pandas as pd
import numpy as np
from math import sqrt
Z = np.random.normal(0,1,10000)
Z1 = np.random.normal(0,1,10000)
Z2 = np.random.normal(0,1,10000)
p = 0.7
X = Z1
Y = p*X+sqrt(1-p**2)*Z
from fbprophet import Prophet
ds = np.linspace(0,8999,9000)
y = Y[:9000]
df = pd.DataFrame(list(zip(ds,Y)),columns = ['ds','y'])
m = Prophet()
m.fit(df)
future = m.make_future_dataframe(periods=1000)
forecast = m.predict(future)
fig1 = m.plot(forecast)
它返回的错误是
MemoryError: Unable to allocate 1.71 PiB for an array with shape (240026674167316,) and data type float64
是什么导致了这个错误?(我使用的是Ubuntu 20.04(
我也遇到了同样的问题,我给我的"ds";以及";y";列。确保";ds";标记的列是日期戳/日期时间;y";列是值。