我正在尝试编写代码来生成一系列arima模型并比较不同的模型.代码如下.
p=0
q=0
d=0
pdq=[]
aic=[]
for p in range(6):
for d in range(2):
for q in range(4):
arima_mod=sm.tsa.ARIMA(df,(p,d,q)).fit(transparams=True)
x=arima_mod.aic
x1= p,d,q
print (x1,x)
aic.append(x)
pdq.append(x1)
keys = pdq
values = aic
d = dict(zip(keys, values))
print (d)
minaic=min(d, key=d.get)
for i in range(3):
p=minaic[0]
d=minaic[1]
q=minaic[2]
print (p,d,q)
Run Code Online (Sandbox Code Playgroud)
'df'是时间序列数据.输出如下,
(0, 0, 0) 1712.55522759
(0, 0, 1) 1693.436483044094
(0, 0, 2) 1695.2226857997066
(0, 0, 3) 1690.9437925956158
(0, 1, 0) 1712.74161799
(0, 1, 1) 1693.0408994539348
(0, 1, 2) 1677.2235087182808
(0, 1, …Run Code Online (Sandbox Code Playgroud) 我试图使用如下代码在python中绘制一组图形.
fig = plt.figure(figsize=(12,8))
ax1 = fig.add_subplot(521)
fig = sm.graphics.tsa.plot_acf(s0, lags=40, ax=ax1)
ax2 = fig.add_subplot(522)
fig = sm.graphics.tsa.plot_pacf(s0, lags=40, ax=ax2)
fig = plt.figure(figsize=(12,8))
ax1 = fig.add_subplot(523)
fig = sm.graphics.tsa.plot_acf(s1, lags=40, ax=ax1)
ax2 = fig.add_subplot(524)
fig = sm.graphics.tsa.plot_pacf(s1, lags=40, ax=ax2)
fig = plt.figure(figsize=(12,8))
ax1 = fig.add_subplot(525)
fig = sm.graphics.tsa.plot_acf(s2, lags=40, ax=ax1)
ax2 = fig.add_subplot(526)
fig = sm.graphics.tsa.plot_pacf(s2, lags=40, ax=ax2)
fig = plt.figure(figsize=(12,8))
ax1 = fig.add_subplot(527)
fig = sm.graphics.tsa.plot_acf(s3, lags=40, ax=ax1)
ax2 = fig.add_subplot(528)
fig = sm.graphics.tsa.plot_pacf(s3, lags=40, ax=ax2)
fig = plt.figure(figsize=(12,8)) …Run Code Online (Sandbox Code Playgroud) 下面的代码应该验证用户名和密码,如果正确应该运行"run.html",否则运行"fail.html",但代码没有按要求执行.代码中的错误是什么?
<!doctype html>
<html>
<body>
<form>
<font size=5><font color="black"><input type="text" placeholder="Username" name="text1"><br /><br /></font>
<font size=5><font color="white"><input type="password" placeholder="Password" name="text2"><br /><br /></font>
<font size=5><input type="submit" value="Login" onclick=javascript.validate(test1.value,test2.value)></font>
</form>
<! javascript>
<script language="javascript">
function validate(text1,text2)
{
if(text1==workshop && text2==workshop)
load("run.html");
else
{
load("fail.html");
}
}
function load(url)
{
location href=url;
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)