noshot 0.9.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.
@@ -1,220 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "id": "6e3f5839-6844-42c3-a57c-5e6324c7ee43",
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
- "from scipy import stats\n",
14
- "from statsmodels.graphics.tsaplots import plot_acf, plot_pacf\n",
15
- "from statsmodels.graphics.api import qqplot\n",
16
- "from statsmodels.tsa.arima.model import ARIMA\n",
17
- "from statsmodels.tsa.stattools import adfuller\n",
18
- "from statsmodels.api import tsa\n",
19
- "from sklearn.metrics import r2_score\n",
20
- "from sklearn.model_selection import TimeSeriesSplit\n",
21
- "import warnings\n",
22
- "warnings.filterwarnings('ignore')"
23
- ]
24
- },
25
- {
26
- "cell_type": "code",
27
- "execution_count": null,
28
- "id": "f32d68f1-db8f-4b74-b23e-2f3ad3b56eed",
29
- "metadata": {},
30
- "outputs": [],
31
- "source": [
32
- "df = pd.read_csv('monthly-sunspots.csv', index_col = 'YEAR')\n",
33
- "df"
34
- ]
35
- },
36
- {
37
- "cell_type": "code",
38
- "execution_count": null,
39
- "id": "500a40bd-7d8f-4d52-923a-ad76d590216f",
40
- "metadata": {
41
- "scrolled": true
42
- },
43
- "outputs": [],
44
- "source": [
45
- "df.plot(figsize=(15,8), color = 'purple')"
46
- ]
47
- },
48
- {
49
- "cell_type": "code",
50
- "execution_count": null,
51
- "id": "6dc6f56f-93bd-4506-b32a-e0f7361829b7",
52
- "metadata": {},
53
- "outputs": [],
54
- "source": [
55
- "result = adfuller(df['SUNACTIVITY'])\n",
56
- "display(result)"
57
- ]
58
- },
59
- {
60
- "cell_type": "code",
61
- "execution_count": null,
62
- "id": "13ece976-8c18-4a2e-b44a-49fa6bc6ff85",
63
- "metadata": {},
64
- "outputs": [],
65
- "source": [
66
- "pvalue = result[1]\n",
67
- "if pvalue < 0.05:\n",
68
- " print(\"Stationary\")\n",
69
- "else:\n",
70
- " print(\"Non Stationary\")"
71
- ]
72
- },
73
- {
74
- "cell_type": "code",
75
- "execution_count": null,
76
- "id": "d83cf3f0-244b-4961-8ff4-dedf97e5a766",
77
- "metadata": {},
78
- "outputs": [],
79
- "source": [
80
- "plot_acf(df['SUNACTIVITY'], lags = 40)\n",
81
- "plot_pacf(df['SUNACTIVITY'], lags = 40)\n",
82
- "plt.show()"
83
- ]
84
- },
85
- {
86
- "cell_type": "code",
87
- "execution_count": null,
88
- "id": "5dacfe47-b35b-46e4-a06f-6001040a6405",
89
- "metadata": {},
90
- "outputs": [],
91
- "source": [
92
- "model = ARIMA(list(df['SUNACTIVITY']), order = (1,0,1))\n",
93
- "result = model.fit()\n",
94
- "pred = result.predict()\n",
95
- "print(r2_score(df, pred))"
96
- ]
97
- },
98
- {
99
- "cell_type": "code",
100
- "execution_count": null,
101
- "id": "171168aa-f0a2-43f1-a195-72b9f3791a53",
102
- "metadata": {},
103
- "outputs": [],
104
- "source": [
105
- "plt.plot(list(df['SUNACTIVITY']))\n",
106
- "plt.plot(pred, linestyle = '--')\n",
107
- "plt.legend(['Actual Sunspots'], ['Predicted SUnspots'])\n",
108
- "plt.xlabel('Timesteps')\n",
109
- "plt.show()"
110
- ]
111
- },
112
- {
113
- "cell_type": "code",
114
- "execution_count": null,
115
- "id": "62e74f51-e0b4-4b22-856b-5a28838375b7",
116
- "metadata": {},
117
- "outputs": [],
118
- "source": [
119
- "ax = pd.Series(result.resid).hist()\n",
120
- "ax.set_xlabel('Residual')\n",
121
- "ax.set_ylabel('Number of Occurences')\n",
122
- "plt.show()"
123
- ]
124
- },
125
- {
126
- "cell_type": "code",
127
- "execution_count": null,
128
- "id": "1cac3ae4-d8f2-49c4-a04d-fabf5290977a",
129
- "metadata": {},
130
- "outputs": [],
131
- "source": [
132
- "result.summary()"
133
- ]
134
- },
135
- {
136
- "cell_type": "code",
137
- "execution_count": null,
138
- "id": "e3ae6db1-4b9c-4a9b-8286-b6484fabb348",
139
- "metadata": {},
140
- "outputs": [],
141
- "source": [
142
- "data_array = df.values\n",
143
- "avg_errors = []\n",
144
- "for p in range(1):\n",
145
- " for q in range(13):\n",
146
- " errors = []\n",
147
- " tscv = TimeSeriesSplit(test_size = 10)\n",
148
- " for train_index, test_index in tscv.split(data_array):\n",
149
- " x_train, x_test = data_array[train_index], data_array[test_index]\n",
150
- " x_test_orig = x_test\n",
151
- "\n",
152
- " fcst = []\n",
153
- " for stop in range(10):\n",
154
- " try:\n",
155
- " mod = ARIMA(x_train, order = (p,0,q))\n",
156
- " res = mod.fit()\n",
157
- " fcst.append(res.forecast(steps = 1))\n",
158
- " except:\n",
159
- " print(\"Error\")\n",
160
- " fcst.append(-9999999.)\n",
161
- " x_train = np.concatenate((x_train, x_test[0:1,]))\n",
162
- " x_test = x_test[1:]\n",
163
- " errors.append(r2_score(x_test_orig, fcst))\n",
164
- " pq_result = [p, q, np.mean(errors)]\n",
165
- " print(pq_result)\n",
166
- " avg_errors.append(pq_result)\n",
167
- "avg_errors = pd.DataFrame(avg_errors)\n",
168
- "avg_errors.columns = ['p', 'q', 'error']\n",
169
- "result = avg_errors.pivot(index = 'p', columns = 'q')"
170
- ]
171
- },
172
- {
173
- "cell_type": "code",
174
- "execution_count": null,
175
- "id": "f0882bbd-e5de-4249-b74c-9f96c6777205",
176
- "metadata": {},
177
- "outputs": [],
178
- "source": [
179
- "dta_array = df.values\n",
180
- "X_train, X_test = dta_array[:10], dta_array[-10:]\n",
181
- "X_test_orig = X_test\n",
182
- "\n",
183
- "fcst = []\n",
184
- "for step in range(10):\n",
185
- " mod = ARIMA(X_train, order = (10,0,9))\n",
186
- " res = mod.fit()\n",
187
- " fcst.append(res.forecast(steps = 1))\n",
188
- " X_train = np.concatenate((X_train, X_test[0:1,:]))\n",
189
- " X_test = X_test[1:]\n",
190
- "\n",
191
- "plt.plot(X_test_orig)\n",
192
- "plt.plot(fcst)\n",
193
- "plt.legend(['Actual Sunspots', 'Predicted Sunspots'])\n",
194
- "plt.xlabel('Time Steps of Test Data')\n",
195
- "plt.show()"
196
- ]
197
- }
198
- ],
199
- "metadata": {
200
- "kernelspec": {
201
- "display_name": "Python 3 (ipykernel)",
202
- "language": "python",
203
- "name": "python3"
204
- },
205
- "language_info": {
206
- "codemirror_mode": {
207
- "name": "ipython",
208
- "version": 3
209
- },
210
- "file_extension": ".py",
211
- "mimetype": "text/x-python",
212
- "name": "python",
213
- "nbconvert_exporter": "python",
214
- "pygments_lexer": "ipython3",
215
- "version": "3.12.4"
216
- }
217
- },
218
- "nbformat": 4,
219
- "nbformat_minor": 5
220
- }
@@ -1,15 +0,0 @@
1
- noshot/__init__.py,sha256=000R40tii8lDFU8C1fBaD3SOnxD0PWRNWZU-km49YrU,21
2
- noshot/main.py,sha256=zXegIqjJPARlPnQMS-B2dAENcvyaZkNwmue63Gm8lHU,663
3
- noshot/data/ML TS XAI/TS/10. Seasonal ARIMA Forecasting.ipynb,sha256=Iq7xWxSx-aubB84YPv0lXzOOn3QG8mTpXkYJ01XjP38,6535
4
- noshot/data/ML TS XAI/TS/11. Multivariate ARIMA Forecasting.ipynb,sha256=kgsay7FG6OKnso-D2JfBM4GB6XrWY5WrvA9fTqrA4uU,5190
5
- noshot/data/ML TS XAI/TS/6. ACF PACF.ipynb,sha256=6fPk4Un3MPEB-TDrN0mKqUFIMa83BT0Rijf0huw7snE,1896
6
- noshot/data/ML TS XAI/TS/7. Differencing.ipynb,sha256=BcPvrF6pgrGEeX74213fMQWpXrmmUAguGg79_xurvds,4133
7
- noshot/data/ML TS XAI/TS/8. ARMA Forecasting.ipynb,sha256=_Rw3ZV1a2-0W1LufbyJqrOzuO8R3lomF0SdBuXxtCZk,5122
8
- noshot/data/ML TS XAI/TS/9. ARIMA Forecasting.ipynb,sha256=_hxn4E0Zg2_N1-jIaFrws13yrR83BHS0eQKHlHHFdjc,5943
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-0.9.0.dist-info/licenses/LICENSE.txt,sha256=fgCruaVm5cUjFGOeEoGIimT6nnUunBqcNZHpGzK8TSw,1086
12
- noshot-0.9.0.dist-info/METADATA,sha256=lvp7MusaB1ymFc0EkPZw-3bMpFyKRcVGG1yVzFXlXEE,2573
13
- noshot-0.9.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
14
- noshot-0.9.0.dist-info/top_level.txt,sha256=UL-c0HffdRwohz-y9icY_rnY48pQDdxGcBsgyCKh2Q8,7
15
- noshot-0.9.0.dist-info/RECORD,,