noshot 1.0.0__py3-none-any.whl → 3.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.
Files changed (57) hide show
  1. noshot/data/ML TS XAI/ML/Main/1. EDA-PCA (Balance Scale Dataset).ipynb +139 -0
  2. noshot/data/ML TS XAI/ML/Main/1. EDA-PCA (Rice Dataset).ipynb +181 -0
  3. noshot/data/ML TS XAI/ML/Main/10. HMM Veterbi.ipynb +228 -0
  4. noshot/data/ML TS XAI/ML/Main/2. KNN (Balance Scale Dataset).ipynb +117 -0
  5. noshot/data/ML TS XAI/ML/Main/2. KNN (Iris Dataset).ipynb +165 -0
  6. noshot/data/ML TS XAI/ML/Main/2. KNN (Sobar-72 Dataset).ipynb +251 -0
  7. noshot/data/ML TS XAI/ML/Main/3. LDA (Balance Scale Dataset).ipynb +78 -0
  8. noshot/data/ML TS XAI/ML/Main/3. LDA (NPHA Doctor Visits Dataset).ipynb +114 -0
  9. noshot/data/ML TS XAI/ML/Main/4. Linear Regression (Machine Dataset).ipynb +115 -0
  10. noshot/data/ML TS XAI/ML/Main/4. Linear Regression (Real Estate Dataset).ipynb +159 -0
  11. noshot/data/ML TS XAI/{XAI/XAI 2/Exp-3 (EDA-loan).ipynb → ML/Main/5. Logistic Regression (Magic04 Dataset).ipynb } +53 -74
  12. noshot/data/ML TS XAI/ML/Main/5. Logistic Regression (Wine Dataset).ipynb +112 -0
  13. noshot/data/ML TS XAI/ML/Main/6. Naive Bayes Classifier (Agaricus Lepiota Dataset).ipynb +153 -0
  14. noshot/data/ML TS XAI/ML/Main/6. Naive Bayes Classifier (Wine Dataset).ipynb +89 -0
  15. noshot/data/ML TS XAI/ML/Main/7. SVM (Rice Dataset).ipynb +208 -0
  16. noshot/data/ML TS XAI/ML/Main/8. FeedForward NN (Sobar72 Dataset).ipynb +260 -0
  17. noshot/data/ML TS XAI/ML/Main/9. CNN (Cifar10 Dataset).ipynb +238 -0
  18. noshot/data/ML TS XAI/ML/Main/data/agaricus-lepiota.data +8124 -0
  19. noshot/data/ML TS XAI/ML/Main/data/balance-scale.txt +625 -0
  20. noshot/data/ML TS XAI/ML/Main/data/doctor-visits.csv +715 -0
  21. noshot/data/ML TS XAI/ML/Main/data/iris.csv +151 -0
  22. noshot/data/ML TS XAI/ML/Main/data/machine-data.csv +210 -0
  23. noshot/data/ML TS XAI/ML/Main/data/magic04.data +19020 -0
  24. noshot/data/ML TS XAI/ML/Main/data/real-estate.xlsx +0 -0
  25. noshot/data/ML TS XAI/ML/Main/data/rice.arff +3826 -0
  26. noshot/data/ML TS XAI/ML/Main/data/sobar-72.csv +73 -0
  27. noshot/data/ML TS XAI/ML/Main/data/wine-dataset.csv +179 -0
  28. noshot/data/ML TS XAI/ML/Other Codes.ipynb +158 -0
  29. noshot/data/ML TS XAI/ML/Rolls Royce AllinOne.ipynb +691 -0
  30. {noshot-1.0.0.dist-info → noshot-3.0.0.dist-info}/METADATA +1 -1
  31. noshot-3.0.0.dist-info/RECORD +38 -0
  32. {noshot-1.0.0.dist-info → noshot-3.0.0.dist-info}/WHEEL +1 -1
  33. noshot/data/ML TS XAI/TS/10. Seasonal ARIMA Forecasting.ipynb +0 -246
  34. noshot/data/ML TS XAI/TS/11. Multivariate ARIMA Forecasting.ipynb +0 -228
  35. noshot/data/ML TS XAI/TS/6. ACF PACF.ipynb +0 -77
  36. noshot/data/ML TS XAI/TS/7. Differencing.ipynb +0 -167
  37. noshot/data/ML TS XAI/TS/8. ARMA Forecasting.ipynb +0 -197
  38. noshot/data/ML TS XAI/TS/9. ARIMA Forecasting.ipynb +0 -220
  39. noshot/data/ML TS XAI/XAI/XAI 1/EDA2_chipsdatset.ipynb +0 -633
  40. noshot/data/ML TS XAI/XAI/XAI 1/EDA_IRISH_8thjan.ipynb +0 -326
  41. noshot/data/ML TS XAI/XAI/XAI 1/XAI_EX1 MODEL BIAS (FINAL).ipynb +0 -487
  42. noshot/data/ML TS XAI/XAI/XAI 1/complete_guide_to_eda_on_text_data.ipynb +0 -845
  43. noshot/data/ML TS XAI/XAI/XAI 1/deepchecksframeworks.ipynb +0 -100
  44. noshot/data/ML TS XAI/XAI/XAI 1/deepexplainers (mnist).ipynb +0 -90
  45. noshot/data/ML TS XAI/XAI/XAI 1/guidedbackpropagation.ipynb +0 -203
  46. noshot/data/ML TS XAI/XAI/XAI 1/updated_image_EDA1_with_LRP.ipynb +0 -3998
  47. noshot/data/ML TS XAI/XAI/XAI 1/zebrastripes.ipynb +0 -271
  48. noshot/data/ML TS XAI/XAI/XAI 2/EXP_5.ipynb +0 -1545
  49. noshot/data/ML TS XAI/XAI/XAI 2/Exp-3 (EDA-movie).ipynb +0 -229
  50. noshot/data/ML TS XAI/XAI/XAI 2/Exp-4(Flower dataset).ipynb +0 -237
  51. noshot/data/ML TS XAI/XAI/XAI 2/Exp-4.ipynb +0 -241
  52. noshot/data/ML TS XAI/XAI/XAI 2/Exp_2.ipynb +0 -352
  53. noshot/data/ML TS XAI/XAI/XAI 2/Exp_7.ipynb +0 -110
  54. noshot/data/ML TS XAI/XAI/XAI 2/FeatureImportance_SensitivityAnalysis.ipynb +0 -708
  55. noshot-1.0.0.dist-info/RECORD +0 -32
  56. {noshot-1.0.0.dist-info → noshot-3.0.0.dist-info}/licenses/LICENSE.txt +0 -0
  57. {noshot-1.0.0.dist-info → noshot-3.0.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: noshot
3
- Version: 1.0.0
3
+ Version: 3.0.0
4
4
  Summary: Support library for Artificial Intelligence, Machine Learning and Data Science tools
5
5
  Author: Tim Stan S
6
6
  License: MIT
@@ -0,0 +1,38 @@
1
+ noshot/__init__.py,sha256=000R40tii8lDFU8C1fBaD3SOnxD0PWRNWZU-km49YrU,21
2
+ noshot/main.py,sha256=zXegIqjJPARlPnQMS-B2dAENcvyaZkNwmue63Gm8lHU,663
3
+ noshot/data/ML TS XAI/ML/Other Codes.ipynb,sha256=e2a_1CTXt7HuXRFUGRkeJyE9ZsdmHiVT5RzqI1AyTDI,4876
4
+ noshot/data/ML TS XAI/ML/Rolls Royce AllinOne.ipynb,sha256=dQ3HgLix6HLqPltFiPrElmEdYAsvR6flDpHEIjcngp4,24774
5
+ noshot/data/ML TS XAI/ML/Main/1. EDA-PCA (Balance Scale Dataset).ipynb,sha256=QlOFmpbc2IJxWUJNd5Mo4p0X-x38l_wTrHxKeRPO3v0,3303
6
+ noshot/data/ML TS XAI/ML/Main/1. EDA-PCA (Rice Dataset).ipynb,sha256=1rp60fJyQl0bxzFWeJb6XR8VRtlQeonv9Yw5_9pvIH8,4133
7
+ noshot/data/ML TS XAI/ML/Main/10. HMM Veterbi.ipynb,sha256=E7fgiDWSvKH_1Wgp5ScGVvbykN4FP4IWFuld8qBJcHs,7266
8
+ noshot/data/ML TS XAI/ML/Main/2. KNN (Balance Scale Dataset).ipynb,sha256=tbkkRm6xHnmM-K8cRpnK8LH1pUmQl30bdyo0dFSNFcw,2988
9
+ noshot/data/ML TS XAI/ML/Main/2. KNN (Iris Dataset).ipynb,sha256=8s0CpQ_VifCzQEgh2KAbh1hB-49j1QvnVBTfBJSkKvQ,4549
10
+ noshot/data/ML TS XAI/ML/Main/2. KNN (Sobar-72 Dataset).ipynb,sha256=OLwRb6dcAzH0om3O3GCo7_ebBRcQs4IwIh9fN2Qf378,6488
11
+ noshot/data/ML TS XAI/ML/Main/3. LDA (Balance Scale Dataset).ipynb,sha256=Z3zwZQKJmvCEgzTWN1OqgiOAF9Lw5oLIY1A63SRJ5tg,2101
12
+ noshot/data/ML TS XAI/ML/Main/3. LDA (NPHA Doctor Visits Dataset).ipynb,sha256=N_IFGBAckF8vJI0lPPbZ1soG50B1_IVyACCyU7jvo3U,2651
13
+ noshot/data/ML TS XAI/ML/Main/4. Linear Regression (Machine Dataset).ipynb,sha256=PxFEgyFi6n5nURhtjeT__OP5T-UsggOI9RfBKfpDNBo,3081
14
+ noshot/data/ML TS XAI/ML/Main/4. Linear Regression (Real Estate Dataset).ipynb,sha256=QR18b8OAO4GAAHT4Cn8ng1rKZlQNhz8P_qfhopIj8m8,3963
15
+ noshot/data/ML TS XAI/ML/Main/5. Logistic Regression (Magic04 Dataset).ipynb,sha256=iPGBdHFobZvpuVVsfB_DcxNZvWg_BMiciz5Ro1I5Y48,4266
16
+ noshot/data/ML TS XAI/ML/Main/5. Logistic Regression (Wine Dataset).ipynb,sha256=YphX35eCBBWu5sCSLS6bw__Em4gbwAzOW49z_Zv-tRs,2668
17
+ noshot/data/ML TS XAI/ML/Main/6. Naive Bayes Classifier (Agaricus Lepiota Dataset).ipynb,sha256=Ewwn2gWNd8C48y8sAk_fG5JHUKBx5pOJMq9aNF-8Cpw,3476
18
+ noshot/data/ML TS XAI/ML/Main/6. Naive Bayes Classifier (Wine Dataset).ipynb,sha256=Ile_WuRAt8Is1HbKdDXu-ogHvQRNBGyxpd8OWauEEek,2058
19
+ noshot/data/ML TS XAI/ML/Main/7. SVM (Rice Dataset).ipynb,sha256=FQo3m4S57Js_n395Fj3VN7nwgMRiA9n8tWqd9i6xYsg,5263
20
+ noshot/data/ML TS XAI/ML/Main/8. FeedForward NN (Sobar72 Dataset).ipynb,sha256=s0T9Fj9-9h8nO6JYmGXKge-y-4ajve1rgt_mlqUgGG0,7258
21
+ noshot/data/ML TS XAI/ML/Main/9. CNN (Cifar10 Dataset).ipynb,sha256=cn-He6Ly_x4pNU_yqFhRs5pv2LqcEoJgHRyYHLttDUs,6424
22
+ noshot/data/ML TS XAI/ML/Main/data/agaricus-lepiota.data,sha256=5l0IIDBQGj68vNfJ98caqdKP3_9GO_TPRxaj_hOsNg4,373704
23
+ noshot/data/ML TS XAI/ML/Main/data/balance-scale.txt,sha256=GPtYUxxyeHEcVqK6AYAZnxzGkIsmEI4lg3cdV-YCoBI,6873
24
+ noshot/data/ML TS XAI/ML/Main/data/doctor-visits.csv,sha256=J9eKD_hIHWw13-jSi2n03ATkIHd_n_YZVIMbBoGF_rI,21769
25
+ noshot/data/ML TS XAI/ML/Main/data/iris.csv,sha256=vYxzzs8E2Gra0TwylbMa4cU6WzeIQsVgGXq9YiplnKU,2927
26
+ noshot/data/ML TS XAI/ML/Main/data/machine-data.csv,sha256=ibOegRM_3qX7IDexXCE5cxvck-1Kz-iQ-A6KKZ9fExA,8956
27
+ noshot/data/ML TS XAI/ML/Main/data/magic04.data,sha256=6TFLfr1LS1mjs9ZfcxZmOWN3exakZ4aHdlHbuqZAs2o,1477391
28
+ noshot/data/ML TS XAI/ML/Main/data/real-estate.xlsx,sha256=1WNNdj5P4TvawWTyl2zAQGTQTRornjUr3BrtV1rhiZQ,30552
29
+ noshot/data/ML TS XAI/ML/Main/data/rice.arff,sha256=Gvl4gxAMid4uopcveijUKPTxwUcRph3vwLBWnp62VmU,427635
30
+ noshot/data/ML TS XAI/ML/Main/data/sobar-72.csv,sha256=RTTPBVbPcvXDFXnzRXWKkkjGX6RliTDjaJviB2648dc,4102
31
+ noshot/data/ML TS XAI/ML/Main/data/wine-dataset.csv,sha256=LM6dldfZUWWlkbhHQdFdMwD2hioTWijjYBJJ1C8wMFY,12440
32
+ noshot/utils/__init__.py,sha256=QVrN1ZpzPXxZqDOqot5-t_ulFjZXVx7Cvr-Is9AK0po,110
33
+ noshot/utils/shell_utils.py,sha256=-XfgYlNQlULa_rRJ3vsfTns4m_jiueGEj396J_y0Gus,2611
34
+ noshot-3.0.0.dist-info/licenses/LICENSE.txt,sha256=fgCruaVm5cUjFGOeEoGIimT6nnUunBqcNZHpGzK8TSw,1086
35
+ noshot-3.0.0.dist-info/METADATA,sha256=rc40sflYs_XKHcGiYIFfQrqnsHr_KWAQK9qOcFZuQ0E,2573
36
+ noshot-3.0.0.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
37
+ noshot-3.0.0.dist-info/top_level.txt,sha256=UL-c0HffdRwohz-y9icY_rnY48pQDdxGcBsgyCKh2Q8,7
38
+ noshot-3.0.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (79.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -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
- }
@@ -1,228 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "id": "8f9faf6e",
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 statsmodels.tsa.stattools import adfuller\n",
14
- "from statsmodels.tsa.stattools import grangercausalitytests\n",
15
- "from statsmodels.tsa.statespace.varmax import VARMAX\n",
16
- "from statsmodels.tsa.api import VAR\n",
17
- "import warnings\n",
18
- "warnings.filterwarnings('ignore')"
19
- ]
20
- },
21
- {
22
- "cell_type": "code",
23
- "execution_count": null,
24
- "id": "da824655",
25
- "metadata": {},
26
- "outputs": [],
27
- "source": [
28
- "custom_column_names = ['WSR0','WSR1']\n",
29
- "df = pd.read_csv('eighthr.csv', parse_dates=[0], na_values=['?'],\n",
30
- " index_col=0, names = (['WSR0', 'WSR1']+list(range(3, 74))))\n",
31
- "df = df.dropna()\n",
32
- "df.head()"
33
- ]
34
- },
35
- {
36
- "cell_type": "code",
37
- "execution_count": null,
38
- "id": "92bf562d",
39
- "metadata": {},
40
- "outputs": [],
41
- "source": [
42
- "df['WSR0'] = df['WSR0'].astype(float)\n",
43
- "df['WSR1'] = df['WSR1'].astype(float)"
44
- ]
45
- },
46
- {
47
- "cell_type": "code",
48
- "execution_count": null,
49
- "id": "f578482e",
50
- "metadata": {},
51
- "outputs": [],
52
- "source": [
53
- "fig,axes = plt.subplots(2,1,figsize=(14,8))\n",
54
- "df['WSR1'].plot(ax=axes[0],title='WSR0')\n",
55
- "df['WSR0'].plot(ax=axes[1],title='WSR1')\n",
56
- "plt.show()"
57
- ]
58
- },
59
- {
60
- "cell_type": "code",
61
- "execution_count": null,
62
- "id": "daac380f",
63
- "metadata": {},
64
- "outputs": [],
65
- "source": [
66
- "result = adfuller(df['WSR0'])\n",
67
- "print(result)\n",
68
- "if result[1]<0.05:\n",
69
- " print(\"It is Stationary\")\n",
70
- "else:\n",
71
- " print(\"It is not stationary\")"
72
- ]
73
- },
74
- {
75
- "cell_type": "code",
76
- "execution_count": null,
77
- "id": "e18f51f2",
78
- "metadata": {},
79
- "outputs": [],
80
- "source": [
81
- "result = adfuller(df['WSR1'])\n",
82
- "print(result)\n",
83
- "if result[1]<0.05:\n",
84
- " print(\"It is Stationary\")\n",
85
- "else:\n",
86
- " print(\"It is not stationary\")"
87
- ]
88
- },
89
- {
90
- "cell_type": "code",
91
- "execution_count": null,
92
- "id": "0b6419c1",
93
- "metadata": {},
94
- "outputs": [],
95
- "source": [
96
- "print('WSR0 causes WSR1')\n",
97
- "print('---------------------')\n",
98
- "granger1=grangercausalitytests(df[['WSR0','WSR1']],2)\n",
99
- "print('WSR1 causes WSR0')\n",
100
- "print('---------------------')\n",
101
- "granger1=grangercausalitytests(df[['WSR1','WSR0']],2)"
102
- ]
103
- },
104
- {
105
- "cell_type": "code",
106
- "execution_count": null,
107
- "id": "b37f4f93",
108
- "metadata": {},
109
- "outputs": [],
110
- "source": [
111
- "train = df[['WSR0','WSR1']]\n",
112
- "model = VAR(train)\n",
113
- "sortedmodel = model.select_order(maxlags=20)\n",
114
- "sortedmodel.summary()"
115
- ]
116
- },
117
- {
118
- "cell_type": "code",
119
- "execution_count": null,
120
- "id": "3da00920",
121
- "metadata": {},
122
- "outputs": [],
123
- "source": [
124
- "model = VARMAX(df[['WSR0', 'WSR1']], order=(10,0),enforce_stationarity=True)\n",
125
- "model_fit = model.fit()\n",
126
- "model_fit.summary()"
127
- ]
128
- },
129
- {
130
- "cell_type": "code",
131
- "execution_count": null,
132
- "id": "0b0cf16d",
133
- "metadata": {},
134
- "outputs": [],
135
- "source": [
136
- "n_forecast = 12\n",
137
- "pred = model_fit.get_prediction()\n",
138
- "preds = pred.predicted_mean"
139
- ]
140
- },
141
- {
142
- "cell_type": "code",
143
- "execution_count": null,
144
- "id": "56954749",
145
- "metadata": {},
146
- "outputs": [],
147
- "source": [
148
- "preds.columns = ['WSR0 Predictions','WSR1 Predictions']\n",
149
- "preds"
150
- ]
151
- },
152
- {
153
- "cell_type": "code",
154
- "execution_count": null,
155
- "id": "704c6372",
156
- "metadata": {},
157
- "outputs": [],
158
- "source": [
159
- "train = df[['WSR0','WSR1']]\n",
160
- "testvspread = pd.concat([train,preds],axis=1)\n",
161
- "testvspread"
162
- ]
163
- },
164
- {
165
- "cell_type": "code",
166
- "execution_count": null,
167
- "id": "d60e3508",
168
- "metadata": {},
169
- "outputs": [],
170
- "source": [
171
- "testvspread[['WSR0','WSR0 Predictions']].plot()"
172
- ]
173
- },
174
- {
175
- "cell_type": "code",
176
- "execution_count": null,
177
- "id": "28fb2660",
178
- "metadata": {},
179
- "outputs": [],
180
- "source": [
181
- "testvspread[['WSR1','WSR1 Predictions']].plot()"
182
- ]
183
- },
184
- {
185
- "cell_type": "code",
186
- "execution_count": null,
187
- "id": "35888acd",
188
- "metadata": {},
189
- "outputs": [],
190
- "source": [
191
- "from sklearn.metrics import mean_squared_error\n",
192
- "mean_squared_error(testvspread['WSR1'],testvspread['WSR1 Predictions'])"
193
- ]
194
- },
195
- {
196
- "cell_type": "code",
197
- "execution_count": null,
198
- "id": "41748e7e",
199
- "metadata": {},
200
- "outputs": [],
201
- "source": [
202
- "from sklearn.metrics import mean_squared_error\n",
203
- "mean_squared_error(testvspread['WSR0'],testvspread['WSR0 Predictions'])"
204
- ]
205
- }
206
- ],
207
- "metadata": {
208
- "kernelspec": {
209
- "display_name": "Python 3 (ipykernel)",
210
- "language": "python",
211
- "name": "python3"
212
- },
213
- "language_info": {
214
- "codemirror_mode": {
215
- "name": "ipython",
216
- "version": 3
217
- },
218
- "file_extension": ".py",
219
- "mimetype": "text/x-python",
220
- "name": "python",
221
- "nbconvert_exporter": "python",
222
- "pygments_lexer": "ipython3",
223
- "version": "3.12.4"
224
- }
225
- },
226
- "nbformat": 4,
227
- "nbformat_minor": 5
228
- }
@@ -1,77 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "id": "97b25ae4-1eb7-4599-bad4-e959bbb9a275",
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 statsmodels.graphics.tsaplots import plot_acf, plot_pacf"
14
- ]
15
- },
16
- {
17
- "cell_type": "code",
18
- "execution_count": null,
19
- "id": "f70584ab-aa4d-4957-9315-3e884f66c559",
20
- "metadata": {},
21
- "outputs": [],
22
- "source": [
23
- "df = pd.read_csv('daily-min-temperatures.csv')\n",
24
- "print(df.shape)\n",
25
- "df.head()"
26
- ]
27
- },
28
- {
29
- "cell_type": "code",
30
- "execution_count": null,
31
- "id": "b6574dd0-e010-423b-bb26-ba2ca142e848",
32
- "metadata": {},
33
- "outputs": [],
34
- "source": [
35
- "df.plot(title = \"daily Minimum Temperature\" ,figsize = (14, 8), legend = None, color = 'green')\n",
36
- "plt.xlabel('Date')\n",
37
- "plt.ylabel('Temperature (°C)')\n",
38
- "plt.show()"
39
- ]
40
- },
41
- {
42
- "cell_type": "code",
43
- "execution_count": null,
44
- "id": "3ba0f2ea-069c-4aa2-aa4b-0d90a54ee21f",
45
- "metadata": {},
46
- "outputs": [],
47
- "source": [
48
- "fig, axs = plt.subplots(2, 1, figsize = (10,8))\n",
49
- "plot_acf(df['Temp'], lags = 30, ax = axs[0], title = 'Autocorrelation (ACF)', color = 'green')\n",
50
- "plot_pacf(df['Temp'], lags = 30, ax = axs[1], title = 'Partial Autocorrelation (PACF)', color = 'red')\n",
51
- "plt.tight_layout()\n",
52
- "plt.show()"
53
- ]
54
- }
55
- ],
56
- "metadata": {
57
- "kernelspec": {
58
- "display_name": "Python 3 (ipykernel)",
59
- "language": "python",
60
- "name": "python3"
61
- },
62
- "language_info": {
63
- "codemirror_mode": {
64
- "name": "ipython",
65
- "version": 3
66
- },
67
- "file_extension": ".py",
68
- "mimetype": "text/x-python",
69
- "name": "python",
70
- "nbconvert_exporter": "python",
71
- "pygments_lexer": "ipython3",
72
- "version": "3.12.4"
73
- }
74
- },
75
- "nbformat": 4,
76
- "nbformat_minor": 5
77
- }