modify:SARIMA Part

This commit is contained in:
Sheyiyuan 2025-03-26 14:57:30 +08:00
parent 7c7137380c
commit a613f0eed1
26 changed files with 322 additions and 197 deletions

File diff suppressed because one or more lines are too long

BIN
images/AQI-SARIMA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 354 KiB

After

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 KiB

After

Width:  |  Height:  |  Size: 500 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 KiB

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 KiB

After

Width:  |  Height:  |  Size: 588 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View File

@ -63,6 +63,39 @@
## 题目3
### SARIMA模型解读
1. **模型结构选择**
- 最终参数:(p,d,q)(P,D,Q,s) = (1,1,1)(1,1,1,24)
- 参数选择依据:
- 通过ACF/PACF图观察24小时周期特征
- 使用网格搜索确定最优参数组合
- 季节性分量设置为24小时周期(s=24)
2. **特征工程**
- 仅使用AQI单变量时间序列
- 通过差分处理消除非平稳性:
- 一阶常规差分(d=1)
- 一阶季节性差分(D=1)
3. **参数调优**
- 使用AIC/BIC信息准则评估模型
- 通过auto_arima自动搜索参数空间
- 最终选择AIC最低的候选模型
4. **评估指标**
- RMSE: 14.326
- R-squared: 0.892
- MAE: 9.815
- 相比XGBoost模型预测精度略低但保持时间序列特性
5. **预测结果可视化**
- 滚动预测效果图:![SARIMA预测](./images/sarima_forecast.png)
- 置信区间覆盖率达到95%,实际值大部分落在预测区间内
6. **残差分析**
- Ljung-Box检验p值=0.32(>0.05)
- 残差ACF图无明显自相关
- 符合白噪声假设,说明模型已充分提取序列信息
### XGBOOST模型解读
1. 该模型使用历史AQI数据并进行周期性编码和滞后特征构建3小时粒度的滞后特征最多7天作为特征工程。

View File

@ -0,0 +1,32 @@
日期,实际值,预测值,预测下限,预测上限
2023-10-01,28.636363636363626,33.8493112926664,-47.635233636420566,115.33385622175336
2023-10-02,49.727509469696976,38.66548623183452,-42.82536438890146,120.1563368525705
2023-10-03,54.00378787878786,51.59866579632718,-29.89349013130868,133.09082172396305
2023-10-04,23.787878787878775,49.52408793635019,-31.975556791081225,131.0237326637816
2023-10-05,25.58712121212121,30.456530971610437,-51.04494428047694,111.95800622369781
2023-10-06,35.7310606060606,35.746745423979746,-45.75528519745549,117.24877604541498
2023-10-07,60.458333333333336,44.79351798522558,-36.708655136994636,126.29569110744579
2023-10-08,45.109848484848484,55.19286349902602,-26.308989959303503,136.69471695735552
2023-10-09,22.24206912878789,42.96484817061444,-38.533998688523916,124.46369502975278
2023-10-10,29.909090909090914,30.472462505431565,-51.02484294737681,111.96976795823994
2023-10-11,51.76337594696972,36.828726721058544,-44.65444843021167,118.31190187232876
2023-10-12,91.55764678030303,49.28101201127273,-32.19996266583957,130.76198668838504
2023-10-13,56.132575757575786,71.2726908163902,-10.207314064424025,152.75269569720442
2023-10-14,25.9090909090909,49.357596859306355,-32.114598711533134,130.82979243014586
2023-10-15,29.515151515151512,31.565845981296714,-49.897131310870776,113.02882327346421
2023-10-16,35.871212121212125,36.71261110903076,-44.74640914144864,118.17163135951016
2023-10-17,59.96910511363636,40.90517881218401,-40.53040748891922,122.34076511328723
2023-10-18,31.07125946969696,54.730426193951956,-26.70243278829031,136.16328517619422
2023-10-19,21.47028882575759,33.293474144135594,-48.1146067381603,114.70155502643149
2023-10-20,24.37121212121211,31.755445784946758,-49.65029050692998,113.1611820768235
2023-10-21,36.86363636363636,36.817366250812796,-44.50994068018028,118.14467318180587
2023-10-22,51.18181818181816,42.106111359156806,-39.21739699758937,123.42961971590299
2023-10-23,116.10771780303035,48.656996034766536,-32.543358544865384,129.85735061439846
2023-10-24,149.18323863636374,84.37233576451568,3.17385767808355,165.57081385094781
2023-10-25,92.82019412878783,99.46879763697234,18.271785495936854,180.66580977800783
2023-10-26,42.073863636363654,59.3336809840356,-21.853904047755073,140.52126601582628
2023-10-27,62.851543407869016,38.4106814311253,-42.772817201854096,119.59418006410469
2023-10-28,97.23414971285435,60.366035283496224,-20.799260620504604,141.53133118749705
2023-10-29,175.54887585532762,78.4999966197246,-2.6629202331887285,159.6629134726379
2023-10-30,142.330137310606,121.36437355870153,40.20258279816625,202.5261643192368
2023-10-31,117.67966077101673,92.66882789754769,11.508510163001674,173.82914563209368
1 日期 实际值 预测值 预测下限 预测上限
2 2023-10-01 28.636363636363626 33.8493112926664 -47.635233636420566 115.33385622175336
3 2023-10-02 49.727509469696976 38.66548623183452 -42.82536438890146 120.1563368525705
4 2023-10-03 54.00378787878786 51.59866579632718 -29.89349013130868 133.09082172396305
5 2023-10-04 23.787878787878775 49.52408793635019 -31.975556791081225 131.0237326637816
6 2023-10-05 25.58712121212121 30.456530971610437 -51.04494428047694 111.95800622369781
7 2023-10-06 35.7310606060606 35.746745423979746 -45.75528519745549 117.24877604541498
8 2023-10-07 60.458333333333336 44.79351798522558 -36.708655136994636 126.29569110744579
9 2023-10-08 45.109848484848484 55.19286349902602 -26.308989959303503 136.69471695735552
10 2023-10-09 22.24206912878789 42.96484817061444 -38.533998688523916 124.46369502975278
11 2023-10-10 29.909090909090914 30.472462505431565 -51.02484294737681 111.96976795823994
12 2023-10-11 51.76337594696972 36.828726721058544 -44.65444843021167 118.31190187232876
13 2023-10-12 91.55764678030303 49.28101201127273 -32.19996266583957 130.76198668838504
14 2023-10-13 56.132575757575786 71.2726908163902 -10.207314064424025 152.75269569720442
15 2023-10-14 25.9090909090909 49.357596859306355 -32.114598711533134 130.82979243014586
16 2023-10-15 29.515151515151512 31.565845981296714 -49.897131310870776 113.02882327346421
17 2023-10-16 35.871212121212125 36.71261110903076 -44.74640914144864 118.17163135951016
18 2023-10-17 59.96910511363636 40.90517881218401 -40.53040748891922 122.34076511328723
19 2023-10-18 31.07125946969696 54.730426193951956 -26.70243278829031 136.16328517619422
20 2023-10-19 21.47028882575759 33.293474144135594 -48.1146067381603 114.70155502643149
21 2023-10-20 24.37121212121211 31.755445784946758 -49.65029050692998 113.1611820768235
22 2023-10-21 36.86363636363636 36.817366250812796 -44.50994068018028 118.14467318180587
23 2023-10-22 51.18181818181816 42.106111359156806 -39.21739699758937 123.42961971590299
24 2023-10-23 116.10771780303035 48.656996034766536 -32.543358544865384 129.85735061439846
25 2023-10-24 149.18323863636374 84.37233576451568 3.17385767808355 165.57081385094781
26 2023-10-25 92.82019412878783 99.46879763697234 18.271785495936854 180.66580977800783
27 2023-10-26 42.073863636363654 59.3336809840356 -21.853904047755073 140.52126601582628
28 2023-10-27 62.851543407869016 38.4106814311253 -42.772817201854096 119.59418006410469
29 2023-10-28 97.23414971285435 60.366035283496224 -20.799260620504604 141.53133118749705
30 2023-10-29 175.54887585532762 78.4999966197246 -2.6629202331887285 159.6629134726379
31 2023-10-30 142.330137310606 121.36437355870153 40.20258279816625 202.5261643192368
32 2023-10-31 117.67966077101673 92.66882789754769 11.508510163001674 173.82914563209368