noshot 1.0.0__py3-none-any.whl → 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- noshot/data/ML TS XAI/TS/bill-charge.ipynb +239 -0
- noshot/data/ML TS XAI/{XAI/XAI 2/Exp-3 (EDA-loan).ipynb → TS/daily-min-temperatures.ipynb } +68 -50
- noshot/data/ML TS XAI/TS/data/bill-data.csv +21 -0
- noshot/data/ML TS XAI/TS/data/daily-min-temperatures.csv +3651 -0
- noshot/data/ML TS XAI/TS/data/monthly-sunspots.csv +2821 -0
- noshot/data/ML TS XAI/TS/monthly-sunspots.ipynb +241 -0
- {noshot-1.0.0.dist-info → noshot-2.0.0.dist-info}/METADATA +1 -1
- noshot-2.0.0.dist-info/RECORD +15 -0
- {noshot-1.0.0.dist-info → noshot-2.0.0.dist-info}/WHEEL +1 -1
- noshot/data/ML TS XAI/TS/10. Seasonal ARIMA Forecasting.ipynb +0 -246
- noshot/data/ML TS XAI/TS/11. Multivariate ARIMA Forecasting.ipynb +0 -228
- noshot/data/ML TS XAI/TS/6. ACF PACF.ipynb +0 -77
- noshot/data/ML TS XAI/TS/7. Differencing.ipynb +0 -167
- noshot/data/ML TS XAI/TS/8. ARMA Forecasting.ipynb +0 -197
- noshot/data/ML TS XAI/TS/9. ARIMA Forecasting.ipynb +0 -220
- noshot/data/ML TS XAI/XAI/XAI 1/EDA2_chipsdatset.ipynb +0 -633
- noshot/data/ML TS XAI/XAI/XAI 1/EDA_IRISH_8thjan.ipynb +0 -326
- noshot/data/ML TS XAI/XAI/XAI 1/XAI_EX1 MODEL BIAS (FINAL).ipynb +0 -487
- noshot/data/ML TS XAI/XAI/XAI 1/complete_guide_to_eda_on_text_data.ipynb +0 -845
- noshot/data/ML TS XAI/XAI/XAI 1/deepchecksframeworks.ipynb +0 -100
- noshot/data/ML TS XAI/XAI/XAI 1/deepexplainers (mnist).ipynb +0 -90
- noshot/data/ML TS XAI/XAI/XAI 1/guidedbackpropagation.ipynb +0 -203
- noshot/data/ML TS XAI/XAI/XAI 1/updated_image_EDA1_with_LRP.ipynb +0 -3998
- noshot/data/ML TS XAI/XAI/XAI 1/zebrastripes.ipynb +0 -271
- noshot/data/ML TS XAI/XAI/XAI 2/EXP_5.ipynb +0 -1545
- noshot/data/ML TS XAI/XAI/XAI 2/Exp-3 (EDA-movie).ipynb +0 -229
- noshot/data/ML TS XAI/XAI/XAI 2/Exp-4(Flower dataset).ipynb +0 -237
- noshot/data/ML TS XAI/XAI/XAI 2/Exp-4.ipynb +0 -241
- noshot/data/ML TS XAI/XAI/XAI 2/Exp_2.ipynb +0 -352
- noshot/data/ML TS XAI/XAI/XAI 2/Exp_7.ipynb +0 -110
- noshot/data/ML TS XAI/XAI/XAI 2/FeatureImportance_SensitivityAnalysis.ipynb +0 -708
- noshot-1.0.0.dist-info/RECORD +0 -32
- {noshot-1.0.0.dist-info → noshot-2.0.0.dist-info}/licenses/LICENSE.txt +0 -0
- {noshot-1.0.0.dist-info → noshot-2.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,241 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": null,
|
6
|
+
"id": "3d63e9c0",
|
7
|
+
"metadata": {},
|
8
|
+
"outputs": [],
|
9
|
+
"source": [
|
10
|
+
"import pandas as pd\n",
|
11
|
+
"import numpy as np\n",
|
12
|
+
"import matplotlib.pyplot as plt\n",
|
13
|
+
"import seaborn as sns\n",
|
14
|
+
"from statsmodels.graphics.tsaplots import plot_acf,plot_pacf\n",
|
15
|
+
"from statsmodels.tsa.stattools import adfuller\n",
|
16
|
+
"from statsmodels.tsa.arima.model import ARIMA\n",
|
17
|
+
"from statsmodels.tsa.statespace import sarimax\n",
|
18
|
+
"from sklearn.metrics import r2_score,mean_squared_error"
|
19
|
+
]
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"cell_type": "code",
|
23
|
+
"execution_count": null,
|
24
|
+
"id": "411787bc",
|
25
|
+
"metadata": {},
|
26
|
+
"outputs": [],
|
27
|
+
"source": [
|
28
|
+
"df=pd.read_csv('data/monthly-sunspots.csv')\n",
|
29
|
+
"df['Date']=df['Month']\n",
|
30
|
+
"del df['Month']\n",
|
31
|
+
"display(df.head())"
|
32
|
+
]
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"cell_type": "code",
|
36
|
+
"execution_count": null,
|
37
|
+
"id": "af7abd2d",
|
38
|
+
"metadata": {},
|
39
|
+
"outputs": [],
|
40
|
+
"source": [
|
41
|
+
"df['Date']=pd.to_datetime(df['Date'])\n",
|
42
|
+
"df"
|
43
|
+
]
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"cell_type": "code",
|
47
|
+
"execution_count": null,
|
48
|
+
"id": "10b20a75",
|
49
|
+
"metadata": {},
|
50
|
+
"outputs": [],
|
51
|
+
"source": [
|
52
|
+
"print(df.isnull().sum())"
|
53
|
+
]
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"cell_type": "code",
|
57
|
+
"execution_count": null,
|
58
|
+
"id": "d8a439ba",
|
59
|
+
"metadata": {},
|
60
|
+
"outputs": [],
|
61
|
+
"source": [
|
62
|
+
"display(df.describe())"
|
63
|
+
]
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"cell_type": "code",
|
67
|
+
"execution_count": null,
|
68
|
+
"id": "d7ef84ea",
|
69
|
+
"metadata": {},
|
70
|
+
"outputs": [],
|
71
|
+
"source": [
|
72
|
+
"df.info()"
|
73
|
+
]
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"cell_type": "code",
|
77
|
+
"execution_count": null,
|
78
|
+
"id": "f79409e8",
|
79
|
+
"metadata": {},
|
80
|
+
"outputs": [],
|
81
|
+
"source": [
|
82
|
+
"plt.plot(df['Sunspots'],label='Sunspots')\n",
|
83
|
+
"plt.xlabel('Date')\n",
|
84
|
+
"plt.ylabel(\"Sunspots\")\n",
|
85
|
+
"plt.legend()\n",
|
86
|
+
"plt.title('Sunspots By Date')\n",
|
87
|
+
"plt.show()"
|
88
|
+
]
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"cell_type": "code",
|
92
|
+
"execution_count": null,
|
93
|
+
"id": "fbf0d907",
|
94
|
+
"metadata": {},
|
95
|
+
"outputs": [],
|
96
|
+
"source": [
|
97
|
+
"def stationarity_test(data):\n",
|
98
|
+
" data=adfuller(data)\n",
|
99
|
+
" print(f'Result : The Data is {\"not\" if data[1]<0.05 else \"\"} Stationary')\n",
|
100
|
+
"\n",
|
101
|
+
"stationarity_test(df['Sunspots'])"
|
102
|
+
]
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"cell_type": "code",
|
106
|
+
"execution_count": null,
|
107
|
+
"id": "7965415d",
|
108
|
+
"metadata": {},
|
109
|
+
"outputs": [],
|
110
|
+
"source": [
|
111
|
+
"plot_acf(df['Sunspots'],lags=7)\n",
|
112
|
+
"plot_pacf(df['Sunspots'],lags=7)\n",
|
113
|
+
"plt.show()"
|
114
|
+
]
|
115
|
+
},
|
116
|
+
{
|
117
|
+
"cell_type": "code",
|
118
|
+
"execution_count": null,
|
119
|
+
"id": "7c5c5023",
|
120
|
+
"metadata": {},
|
121
|
+
"outputs": [],
|
122
|
+
"source": [
|
123
|
+
"arma_model=ARIMA(df['Sunspots'],order=(2,0,0))\n",
|
124
|
+
"arma_fit=arma_model.fit()\n",
|
125
|
+
"display(arma_fit.summary())"
|
126
|
+
]
|
127
|
+
},
|
128
|
+
{
|
129
|
+
"cell_type": "code",
|
130
|
+
"execution_count": null,
|
131
|
+
"id": "46da16b9",
|
132
|
+
"metadata": {},
|
133
|
+
"outputs": [],
|
134
|
+
"source": [
|
135
|
+
"arima_model=ARIMA(df['Sunspots'],order=(2,1,0))\n",
|
136
|
+
"arima_fit=arima_model.fit()\n",
|
137
|
+
"display(arima_fit.summary())"
|
138
|
+
]
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"cell_type": "code",
|
142
|
+
"execution_count": null,
|
143
|
+
"id": "1e629e66",
|
144
|
+
"metadata": {},
|
145
|
+
"outputs": [],
|
146
|
+
"source": [
|
147
|
+
"sarima_model=sarimax.SARIMAX(df['Sunspots'],order=(1,1,0),seasonal_order=(1,2,0,4))\n",
|
148
|
+
"sarima_fit=sarima_model.fit()\n",
|
149
|
+
"display(sarima_fit.summary())"
|
150
|
+
]
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"cell_type": "code",
|
154
|
+
"execution_count": null,
|
155
|
+
"id": "e3ae7519",
|
156
|
+
"metadata": {},
|
157
|
+
"outputs": [],
|
158
|
+
"source": [
|
159
|
+
"display(arma_fit.aic,arima_fit.aic,sarima_fit.aic)"
|
160
|
+
]
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"cell_type": "code",
|
164
|
+
"execution_count": null,
|
165
|
+
"id": "e9e40bbd",
|
166
|
+
"metadata": {},
|
167
|
+
"outputs": [],
|
168
|
+
"source": [
|
169
|
+
"display(arma_fit.bic,arima_fit.bic,sarima_fit.bic)"
|
170
|
+
]
|
171
|
+
},
|
172
|
+
{
|
173
|
+
"cell_type": "code",
|
174
|
+
"execution_count": null,
|
175
|
+
"id": "8773dcb6",
|
176
|
+
"metadata": {},
|
177
|
+
"outputs": [],
|
178
|
+
"source": [
|
179
|
+
"display(arma_fit.hqic,arima_fit.hqic,sarima_fit.hqic)"
|
180
|
+
]
|
181
|
+
},
|
182
|
+
{
|
183
|
+
"cell_type": "code",
|
184
|
+
"execution_count": null,
|
185
|
+
"id": "50ca8a19",
|
186
|
+
"metadata": {},
|
187
|
+
"outputs": [],
|
188
|
+
"source": [
|
189
|
+
"arima_fit.resid.plot(color='teal')\n",
|
190
|
+
"plt.title('Residual Plot')\n",
|
191
|
+
"plt.show()"
|
192
|
+
]
|
193
|
+
},
|
194
|
+
{
|
195
|
+
"cell_type": "code",
|
196
|
+
"execution_count": null,
|
197
|
+
"id": "6b6ddce5",
|
198
|
+
"metadata": {},
|
199
|
+
"outputs": [],
|
200
|
+
"source": [
|
201
|
+
"plt.plot(df['Sunspots'],label='Original',color='blue')\n",
|
202
|
+
"plt.plot(arima_fit.predict(),label='Forecast',color='red')\n",
|
203
|
+
"plt.title(\"Forecast\")\n",
|
204
|
+
"plt.legend()\n",
|
205
|
+
"plt.show()"
|
206
|
+
]
|
207
|
+
},
|
208
|
+
{
|
209
|
+
"cell_type": "code",
|
210
|
+
"execution_count": null,
|
211
|
+
"id": "d3839c19",
|
212
|
+
"metadata": {},
|
213
|
+
"outputs": [],
|
214
|
+
"source": [
|
215
|
+
"print(f\"r2_Score : {r2_score(df['Sunspots'],arima_fit.predict())}\")\n",
|
216
|
+
"print(f\"Mean Squared Error : {mean_squared_error(df['Sunspots'],arima_fit.predict())}\")"
|
217
|
+
]
|
218
|
+
}
|
219
|
+
],
|
220
|
+
"metadata": {
|
221
|
+
"kernelspec": {
|
222
|
+
"display_name": "Python 3 (ipykernel)",
|
223
|
+
"language": "python",
|
224
|
+
"name": "python3"
|
225
|
+
},
|
226
|
+
"language_info": {
|
227
|
+
"codemirror_mode": {
|
228
|
+
"name": "ipython",
|
229
|
+
"version": 3
|
230
|
+
},
|
231
|
+
"file_extension": ".py",
|
232
|
+
"mimetype": "text/x-python",
|
233
|
+
"name": "python",
|
234
|
+
"nbconvert_exporter": "python",
|
235
|
+
"pygments_lexer": "ipython3",
|
236
|
+
"version": "3.12.4"
|
237
|
+
}
|
238
|
+
},
|
239
|
+
"nbformat": 4,
|
240
|
+
"nbformat_minor": 5
|
241
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
noshot/__init__.py,sha256=000R40tii8lDFU8C1fBaD3SOnxD0PWRNWZU-km49YrU,21
|
2
|
+
noshot/main.py,sha256=zXegIqjJPARlPnQMS-B2dAENcvyaZkNwmue63Gm8lHU,663
|
3
|
+
noshot/data/ML TS XAI/TS/bill-charge.ipynb,sha256=YL8YClvZGctD1gEMZXf0XNlAGaqdvRJ5-73_8b3ij3Q,5205
|
4
|
+
noshot/data/ML TS XAI/TS/daily-min-temperatures.ipynb,sha256=N7q4NBhBXzzlmp97R3gNh4Fh-EarM7J9sdgAWzsQKIw,5119
|
5
|
+
noshot/data/ML TS XAI/TS/monthly-sunspots.ipynb,sha256=mcyjIFL5Zye5j_HqEqFQns4fnu3NzYTUfEXa2jPfnPU,5226
|
6
|
+
noshot/data/ML TS XAI/TS/data/bill-data.csv,sha256=X5CgQyNbpbCpsjdNLatK8__Qg_yiscOVqo9k1rzJRPQ,490
|
7
|
+
noshot/data/ML TS XAI/TS/data/daily-min-temperatures.csv,sha256=neLFZzg9m1CUv3S4fitPJqrqSx3xOMVD08JIJS_Efm4,59637
|
8
|
+
noshot/data/ML TS XAI/TS/data/monthly-sunspots.csv,sha256=xOyMxX2fb7bs2z4fN_Jbb0ut1RJMVZMQUrDNL8O8cfM,45039
|
9
|
+
noshot/utils/__init__.py,sha256=QVrN1ZpzPXxZqDOqot5-t_ulFjZXVx7Cvr-Is9AK0po,110
|
10
|
+
noshot/utils/shell_utils.py,sha256=-XfgYlNQlULa_rRJ3vsfTns4m_jiueGEj396J_y0Gus,2611
|
11
|
+
noshot-2.0.0.dist-info/licenses/LICENSE.txt,sha256=fgCruaVm5cUjFGOeEoGIimT6nnUunBqcNZHpGzK8TSw,1086
|
12
|
+
noshot-2.0.0.dist-info/METADATA,sha256=G9BAFS8FqRu2zMFDf_kt3JyOAPIHYU0MabufJ8UEHto,2573
|
13
|
+
noshot-2.0.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
14
|
+
noshot-2.0.0.dist-info/top_level.txt,sha256=UL-c0HffdRwohz-y9icY_rnY48pQDdxGcBsgyCKh2Q8,7
|
15
|
+
noshot-2.0.0.dist-info/RECORD,,
|
@@ -1,246 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": null,
|
6
|
-
"id": "142adfce-1c93-475a-a465-0f344cbc6b93",
|
7
|
-
"metadata": {},
|
8
|
-
"outputs": [],
|
9
|
-
"source": [
|
10
|
-
"import numpy as np\n",
|
11
|
-
"import pandas as pd\n",
|
12
|
-
"import matplotlib.pyplot as plt\n",
|
13
|
-
"from sklearn.metrics import mean_squared_error\n",
|
14
|
-
"from pandas.plotting import autocorrelation_plot\n",
|
15
|
-
"from statsmodels.graphics.tsaplots import plot_acf, plot_pacf\n",
|
16
|
-
"import statsmodels.api as sm\n",
|
17
|
-
"from statsmodels.tsa.arima_model import ARIMA\n",
|
18
|
-
"import warnings\n",
|
19
|
-
"warnings.filterwarnings('ignore')"
|
20
|
-
]
|
21
|
-
},
|
22
|
-
{
|
23
|
-
"cell_type": "code",
|
24
|
-
"execution_count": null,
|
25
|
-
"id": "b10b8b58-6c78-442e-b712-67b16f228f15",
|
26
|
-
"metadata": {},
|
27
|
-
"outputs": [],
|
28
|
-
"source": [
|
29
|
-
"df = pd.read_csv('monthly-sunspots.csv', parse_dates=[0])\n",
|
30
|
-
"df.head(10)"
|
31
|
-
]
|
32
|
-
},
|
33
|
-
{
|
34
|
-
"cell_type": "code",
|
35
|
-
"execution_count": null,
|
36
|
-
"id": "3b123997-e868-4998-bbb6-9031ea8ab39f",
|
37
|
-
"metadata": {},
|
38
|
-
"outputs": [],
|
39
|
-
"source": [
|
40
|
-
"plt.figure(figsize=(10,8))\n",
|
41
|
-
"plt.plot(df['Month'], df['Sunspots'], color = 'green', label = 'Sunspot Numbers')\n",
|
42
|
-
"plt.xlabel('Date')\n",
|
43
|
-
"plt.ylabel('Sunspot Numbers')\n",
|
44
|
-
"plt.grid()\n",
|
45
|
-
"plt.title('Monthly Mean Sunspot Numbers')\n",
|
46
|
-
"plt.show()"
|
47
|
-
]
|
48
|
-
},
|
49
|
-
{
|
50
|
-
"cell_type": "code",
|
51
|
-
"execution_count": null,
|
52
|
-
"id": "9c56e5d1-a019-457b-8313-c5f71b378a5a",
|
53
|
-
"metadata": {},
|
54
|
-
"outputs": [],
|
55
|
-
"source": [
|
56
|
-
"df.describe().T"
|
57
|
-
]
|
58
|
-
},
|
59
|
-
{
|
60
|
-
"cell_type": "code",
|
61
|
-
"execution_count": null,
|
62
|
-
"id": "94752ac3-fb85-41c1-94dc-f1a05b0baf75",
|
63
|
-
"metadata": {},
|
64
|
-
"outputs": [],
|
65
|
-
"source": [
|
66
|
-
"df['Month'] = pd.to_datetime(df['Month'])\n",
|
67
|
-
"data_new = df.set_index(df['Month'])\n",
|
68
|
-
"data_new = data_new.drop(labels = ['Month'], axis = 1)\n",
|
69
|
-
"data_new.head()"
|
70
|
-
]
|
71
|
-
},
|
72
|
-
{
|
73
|
-
"cell_type": "code",
|
74
|
-
"execution_count": null,
|
75
|
-
"id": "b02c91b4-f7ee-4ce5-b707-6bf2604bed55",
|
76
|
-
"metadata": {},
|
77
|
-
"outputs": [],
|
78
|
-
"source": [
|
79
|
-
"fig = plt.figure(figsize=(10,8))\n",
|
80
|
-
"data_new['Sunspots'].plot(style = 'k.')"
|
81
|
-
]
|
82
|
-
},
|
83
|
-
{
|
84
|
-
"cell_type": "code",
|
85
|
-
"execution_count": null,
|
86
|
-
"id": "dca190cd-41b8-44d5-8ed2-190c87b04fb9",
|
87
|
-
"metadata": {},
|
88
|
-
"outputs": [],
|
89
|
-
"source": [
|
90
|
-
"data_q = data_new.resample('q').mean()\n",
|
91
|
-
"data_q.head()"
|
92
|
-
]
|
93
|
-
},
|
94
|
-
{
|
95
|
-
"cell_type": "code",
|
96
|
-
"execution_count": null,
|
97
|
-
"id": "1f944805-6b99-4854-a7c2-53bf2a6de1c2",
|
98
|
-
"metadata": {},
|
99
|
-
"outputs": [],
|
100
|
-
"source": [
|
101
|
-
"def adfuller_test(data):\n",
|
102
|
-
" result = adfuller(data)\n",
|
103
|
-
" labels = ['ADF Test Statistic' 'P-value', 'Lags Used', 'Number of Observation Used']\n",
|
104
|
-
" for value, label in zip(result, labels):\n",
|
105
|
-
" print(label+\": \"+str(value))\n",
|
106
|
-
" if result[1] <= 0.05:\n",
|
107
|
-
" print(\"Strong evidencew against the null hypothesis(h0), reject the null hypothesis. Data has no unit root and is stationary\")\n",
|
108
|
-
" else:\n",
|
109
|
-
" print(\"Weak evidence against null hypothesis, time series has a unit root, indicating it is non-stationary\")"
|
110
|
-
]
|
111
|
-
},
|
112
|
-
{
|
113
|
-
"cell_type": "code",
|
114
|
-
"execution_count": null,
|
115
|
-
"id": "1e2740f4-ba2b-4fc4-a310-131b15ae20cb",
|
116
|
-
"metadata": {},
|
117
|
-
"outputs": [],
|
118
|
-
"source": [
|
119
|
-
"data_q.plot(figsize=(10,8))"
|
120
|
-
]
|
121
|
-
},
|
122
|
-
{
|
123
|
-
"cell_type": "code",
|
124
|
-
"execution_count": null,
|
125
|
-
"id": "8062e59f-4149-45fc-b2ca-3f586c6ed078",
|
126
|
-
"metadata": {},
|
127
|
-
"outputs": [],
|
128
|
-
"source": [
|
129
|
-
"base_data = data_q.copy()\n",
|
130
|
-
"base_data['Monthly Mean Total Sunspot Number'] = base_data['Sunspots']\n",
|
131
|
-
"base_data['Shifter Monthly Mean Total Sunspot Number'] = base_data['Monthly Mean Total Sunspot Number'].shift(1)"
|
132
|
-
]
|
133
|
-
},
|
134
|
-
{
|
135
|
-
"cell_type": "code",
|
136
|
-
"execution_count": null,
|
137
|
-
"id": "8232f405-2560-4b9a-870e-8af209ef0f87",
|
138
|
-
"metadata": {},
|
139
|
-
"outputs": [],
|
140
|
-
"source": [
|
141
|
-
"base_data.head()"
|
142
|
-
]
|
143
|
-
},
|
144
|
-
{
|
145
|
-
"cell_type": "code",
|
146
|
-
"execution_count": null,
|
147
|
-
"id": "9cb81777-9f8d-4c64-ad4f-7c245454085e",
|
148
|
-
"metadata": {},
|
149
|
-
"outputs": [],
|
150
|
-
"source": [
|
151
|
-
"base_data[['Monthly Mean Total Sunspot Number', 'Shifter Monthly Mean Total Sunspot Number']].plot()"
|
152
|
-
]
|
153
|
-
},
|
154
|
-
{
|
155
|
-
"cell_type": "code",
|
156
|
-
"execution_count": null,
|
157
|
-
"id": "1e27fde3-cef9-4366-a972-52a974226d91",
|
158
|
-
"metadata": {},
|
159
|
-
"outputs": [],
|
160
|
-
"source": [
|
161
|
-
"base_data = base_data.dropna()\n",
|
162
|
-
"print(\"Mean Squared Error:\", mean_squared_error(base_data['Monthly Mean Total Sunspot Number'], \n",
|
163
|
-
" base_data['Shifter Monthly Mean Total Sunspot Number']))"
|
164
|
-
]
|
165
|
-
},
|
166
|
-
{
|
167
|
-
"cell_type": "code",
|
168
|
-
"execution_count": null,
|
169
|
-
"id": "cd01e7eb-5e88-41e8-9ddd-1ea35f054b4b",
|
170
|
-
"metadata": {},
|
171
|
-
"outputs": [],
|
172
|
-
"source": [
|
173
|
-
"fig = plt.figure(figsize=(10,8))\n",
|
174
|
-
"autocorrelation_plot(data_q)\n",
|
175
|
-
"plt.show()"
|
176
|
-
]
|
177
|
-
},
|
178
|
-
{
|
179
|
-
"cell_type": "code",
|
180
|
-
"execution_count": null,
|
181
|
-
"id": "2d127256-a9cc-431d-95ae-6f8323aa21b7",
|
182
|
-
"metadata": {},
|
183
|
-
"outputs": [],
|
184
|
-
"source": [
|
185
|
-
"fig = plt.figure(figsize=(10,8))\n",
|
186
|
-
"ax1 = fig.add_subplot(211)\n",
|
187
|
-
"fig = sm.graphics.tsa.plot_acf(data_q, lags = 40, ax = ax1)\n",
|
188
|
-
"ax2 = fig.add_subplot(212)\n",
|
189
|
-
"fig = sm.graphics.tsa.plot_pacf(data_q, lags = 40, ax = ax2)"
|
190
|
-
]
|
191
|
-
},
|
192
|
-
{
|
193
|
-
"cell_type": "code",
|
194
|
-
"execution_count": null,
|
195
|
-
"id": "03258c9e-a3b6-465b-98ca-d5cc6a481626",
|
196
|
-
"metadata": {},
|
197
|
-
"outputs": [],
|
198
|
-
"source": [
|
199
|
-
"model = sm.tsa.statespace.SARIMAX(data_q['Sunspots'], order=(2,0,2), seasonal_order=(2,0,2,6))\n",
|
200
|
-
"results = model.fit()"
|
201
|
-
]
|
202
|
-
},
|
203
|
-
{
|
204
|
-
"cell_type": "code",
|
205
|
-
"execution_count": null,
|
206
|
-
"id": "4eb643eb-59ae-475c-9096-87e536da8e62",
|
207
|
-
"metadata": {},
|
208
|
-
"outputs": [],
|
209
|
-
"source": [
|
210
|
-
"results.summary()"
|
211
|
-
]
|
212
|
-
},
|
213
|
-
{
|
214
|
-
"cell_type": "code",
|
215
|
-
"execution_count": null,
|
216
|
-
"id": "c2350c09-4c80-4c24-88d8-3b645981ce21",
|
217
|
-
"metadata": {},
|
218
|
-
"outputs": [],
|
219
|
-
"source": [
|
220
|
-
"data_q['forecast'] = results.predict(start = 1000, end = 1084, dynamic = True)\n",
|
221
|
-
"data_q[['Sunspots', 'forecast']].plot(figsize = (10,8))"
|
222
|
-
]
|
223
|
-
}
|
224
|
-
],
|
225
|
-
"metadata": {
|
226
|
-
"kernelspec": {
|
227
|
-
"display_name": "Python 3 (ipykernel)",
|
228
|
-
"language": "python",
|
229
|
-
"name": "python3"
|
230
|
-
},
|
231
|
-
"language_info": {
|
232
|
-
"codemirror_mode": {
|
233
|
-
"name": "ipython",
|
234
|
-
"version": 3
|
235
|
-
},
|
236
|
-
"file_extension": ".py",
|
237
|
-
"mimetype": "text/x-python",
|
238
|
-
"name": "python",
|
239
|
-
"nbconvert_exporter": "python",
|
240
|
-
"pygments_lexer": "ipython3",
|
241
|
-
"version": "3.12.4"
|
242
|
-
}
|
243
|
-
},
|
244
|
-
"nbformat": 4,
|
245
|
-
"nbformat_minor": 5
|
246
|
-
}
|