noshot 2.0.0__py3-none-any.whl → 4.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 (43) hide show
  1. noshot/data/ML TS XAI/ML/ML Lab CIA 2 (I Found Only This Check)/Copy_of_Pistachio_csv.ipynb +269 -0
  2. noshot/data/ML TS XAI/ML/ML Lab CIA 2 (I Found Only This Check)/weatherAUS.ipynb +155 -0
  3. noshot/data/ML TS XAI/ML/Main/1. EDA-PCA (Balance Scale Dataset).ipynb +139 -0
  4. noshot/data/ML TS XAI/ML/Main/1. EDA-PCA (Rice Dataset).ipynb +181 -0
  5. noshot/data/ML TS XAI/ML/Main/10. HMM Veterbi.ipynb +228 -0
  6. noshot/data/ML TS XAI/ML/Main/2. KNN (Balance Scale Dataset).ipynb +117 -0
  7. noshot/data/ML TS XAI/ML/Main/2. KNN (Iris Dataset).ipynb +165 -0
  8. noshot/data/ML TS XAI/ML/Main/2. KNN (Sobar-72 Dataset).ipynb +251 -0
  9. noshot/data/ML TS XAI/ML/Main/3. LDA (Balance Scale Dataset).ipynb +78 -0
  10. noshot/data/ML TS XAI/ML/Main/3. LDA (NPHA Doctor Visits Dataset).ipynb +114 -0
  11. noshot/data/ML TS XAI/ML/Main/4. Linear Regression (Machine Dataset).ipynb +115 -0
  12. noshot/data/ML TS XAI/ML/Main/4. Linear Regression (Real Estate Dataset).ipynb +159 -0
  13. noshot/data/ML TS XAI/ML/Main/5. Logistic Regression (Magic04 Dataset).ipynb +200 -0
  14. noshot/data/ML TS XAI/ML/Main/5. Logistic Regression (Wine Dataset).ipynb +112 -0
  15. noshot/data/ML TS XAI/ML/Main/6. Naive Bayes Classifier (Agaricus Lepiota Dataset).ipynb +153 -0
  16. noshot/data/ML TS XAI/ML/Main/6. Naive Bayes Classifier (Wine Dataset).ipynb +89 -0
  17. noshot/data/ML TS XAI/ML/Main/7. SVM (Rice Dataset).ipynb +208 -0
  18. noshot/data/ML TS XAI/ML/Main/8. FeedForward NN (Sobar72 Dataset).ipynb +260 -0
  19. noshot/data/ML TS XAI/ML/Main/9. CNN (Cifar10 Dataset).ipynb +238 -0
  20. noshot/data/ML TS XAI/ML/Main/data/agaricus-lepiota.data +8124 -0
  21. noshot/data/ML TS XAI/ML/Main/data/balance-scale.txt +625 -0
  22. noshot/data/ML TS XAI/ML/Main/data/doctor-visits.csv +715 -0
  23. noshot/data/ML TS XAI/ML/Main/data/iris.csv +151 -0
  24. noshot/data/ML TS XAI/ML/Main/data/machine-data.csv +210 -0
  25. noshot/data/ML TS XAI/ML/Main/data/magic04.data +19020 -0
  26. noshot/data/ML TS XAI/ML/Main/data/real-estate.xlsx +0 -0
  27. noshot/data/ML TS XAI/ML/Main/data/rice.arff +3826 -0
  28. noshot/data/ML TS XAI/ML/Main/data/sobar-72.csv +73 -0
  29. noshot/data/ML TS XAI/ML/Main/data/wine-dataset.csv +179 -0
  30. noshot/data/ML TS XAI/ML/Other Codes.ipynb +158 -0
  31. noshot/data/ML TS XAI/ML/Rolls Royce AllinOne.ipynb +691 -0
  32. {noshot-2.0.0.dist-info → noshot-4.0.0.dist-info}/METADATA +1 -1
  33. noshot-4.0.0.dist-info/RECORD +40 -0
  34. {noshot-2.0.0.dist-info → noshot-4.0.0.dist-info}/WHEEL +1 -1
  35. noshot/data/ML TS XAI/TS/bill-charge.ipynb +0 -239
  36. noshot/data/ML TS XAI/TS/daily-min-temperatures.ipynb +0 -239
  37. noshot/data/ML TS XAI/TS/data/bill-data.csv +0 -21
  38. noshot/data/ML TS XAI/TS/data/daily-min-temperatures.csv +0 -3651
  39. noshot/data/ML TS XAI/TS/data/monthly-sunspots.csv +0 -2821
  40. noshot/data/ML TS XAI/TS/monthly-sunspots.ipynb +0 -241
  41. noshot-2.0.0.dist-info/RECORD +0 -15
  42. {noshot-2.0.0.dist-info → noshot-4.0.0.dist-info}/licenses/LICENSE.txt +0 -0
  43. {noshot-2.0.0.dist-info → noshot-4.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,238 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {
7
+ "id": "wHmdCsrz61l7"
8
+ },
9
+ "outputs": [],
10
+ "source": [
11
+ "import tensorflow as tf\n",
12
+ "from tensorflow import keras\n",
13
+ "from tensorflow.keras import layers\n",
14
+ "import numpy as np\n",
15
+ "from keras.datasets import cifar10\n",
16
+ "import tensorflow as tf\n",
17
+ "from keras.preprocessing import image\n",
18
+ "from tensorflow.keras.preprocessing.image import ImageDataGenerator\n",
19
+ "from keras.models import Sequential\n",
20
+ "from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D, Dropout, BatchNormalization\n",
21
+ "from keras.utils import to_categorical\n",
22
+ "from keras.applications.vgg19 import VGG19\n",
23
+ "from tensorflow.keras.optimizers import RMSprop\n",
24
+ "from keras.datasets import cifar10\n",
25
+ "from sklearn.metrics import classification_report, confusion_matrix\n",
26
+ "from keras.callbacks import EarlyStopping, ReduceLROnPlateau\n",
27
+ "import os\n",
28
+ "import warnings\n",
29
+ "warnings.filterwarnings('ignore')"
30
+ ]
31
+ },
32
+ {
33
+ "cell_type": "code",
34
+ "execution_count": null,
35
+ "metadata": {
36
+ "colab": {
37
+ "base_uri": "https://localhost:8080/"
38
+ },
39
+ "id": "dghWl91B66Ey",
40
+ "outputId": "a14fb7c3-44a7-4d93-805e-708ecc2157ef"
41
+ },
42
+ "outputs": [],
43
+ "source": [
44
+ "from tensorflow.keras.datasets import cifar10\n",
45
+ "from tensorflow.keras.utils import to_categorical\n",
46
+ "import tensorflow as tf\n",
47
+ "from tensorflow import keras\n",
48
+ "from tensorflow.keras import layers\n",
49
+ "import matplotlib.pyplot as plt"
50
+ ]
51
+ },
52
+ {
53
+ "cell_type": "code",
54
+ "execution_count": null,
55
+ "metadata": {
56
+ "colab": {
57
+ "base_uri": "https://localhost:8080/"
58
+ },
59
+ "id": "dghWl91B66Ey",
60
+ "outputId": "a14fb7c3-44a7-4d93-805e-708ecc2157ef"
61
+ },
62
+ "outputs": [],
63
+ "source": [
64
+ "(X_train, y_train), (X_test, y_test) = cifar10.load_data()"
65
+ ]
66
+ },
67
+ {
68
+ "cell_type": "code",
69
+ "execution_count": null,
70
+ "metadata": {
71
+ "colab": {
72
+ "base_uri": "https://localhost:8080/"
73
+ },
74
+ "id": "dghWl91B66Ey",
75
+ "outputId": "a14fb7c3-44a7-4d93-805e-708ecc2157ef"
76
+ },
77
+ "outputs": [],
78
+ "source": [
79
+ "def preprocess_data(X, y):\n",
80
+ " X = X.astype('float32') / 255.0 # Normalize to [0, 1]\n",
81
+ " y = to_categorical(y, num_classes=10) # One-hot encode labels\n",
82
+ " return X, y"
83
+ ]
84
+ },
85
+ {
86
+ "cell_type": "code",
87
+ "execution_count": null,
88
+ "metadata": {
89
+ "colab": {
90
+ "base_uri": "https://localhost:8080/"
91
+ },
92
+ "id": "dghWl91B66Ey",
93
+ "outputId": "a14fb7c3-44a7-4d93-805e-708ecc2157ef"
94
+ },
95
+ "outputs": [],
96
+ "source": [
97
+ " \n",
98
+ "x_train, y_train = preprocess_data(X_train, y_train)\n",
99
+ "x_test, y_test = preprocess_data(X_test, y_test)"
100
+ ]
101
+ },
102
+ {
103
+ "cell_type": "code",
104
+ "execution_count": null,
105
+ "metadata": {
106
+ "colab": {
107
+ "base_uri": "https://localhost:8080/"
108
+ },
109
+ "id": "dghWl91B66Ey",
110
+ "outputId": "a14fb7c3-44a7-4d93-805e-708ecc2157ef"
111
+ },
112
+ "outputs": [],
113
+ "source": [
114
+ "model = keras.Sequential(\n",
115
+ " [\n",
116
+ " keras.Input(shape=(32, 32, 3)),\n",
117
+ " layers.Conv2D(32, kernel_size=(3, 3), activation=\"relu\"),\n",
118
+ " layers.MaxPooling2D(pool_size=(2, 2)),\n",
119
+ " layers.Conv2D(64, kernel_size=(3, 3), activation=\"relu\"),\n",
120
+ " layers.MaxPooling2D(pool_size=(2, 2)),\n",
121
+ " layers.Flatten(),\n",
122
+ " layers.Dense(10, activation=\"softmax\"),\n",
123
+ " ]\n",
124
+ ")"
125
+ ]
126
+ },
127
+ {
128
+ "cell_type": "code",
129
+ "execution_count": null,
130
+ "metadata": {
131
+ "colab": {
132
+ "base_uri": "https://localhost:8080/"
133
+ },
134
+ "id": "dghWl91B66Ey",
135
+ "outputId": "a14fb7c3-44a7-4d93-805e-708ecc2157ef"
136
+ },
137
+ "outputs": [],
138
+ "source": [
139
+ "model.compile(loss=\"categorical_crossentropy\", optimizer=\"adam\", metrics=[\"accuracy\"])"
140
+ ]
141
+ },
142
+ {
143
+ "cell_type": "code",
144
+ "execution_count": null,
145
+ "metadata": {
146
+ "colab": {
147
+ "base_uri": "https://localhost:8080/"
148
+ },
149
+ "id": "dghWl91B66Ey",
150
+ "outputId": "a14fb7c3-44a7-4d93-805e-708ecc2157ef"
151
+ },
152
+ "outputs": [],
153
+ "source": [
154
+ "early_stopping = tf.keras.callbacks.EarlyStopping(\n",
155
+ " monitor='val_loss',\n",
156
+ " patience=10,\n",
157
+ " restore_best_weights=True)"
158
+ ]
159
+ },
160
+ {
161
+ "cell_type": "code",
162
+ "execution_count": null,
163
+ "metadata": {
164
+ "colab": {
165
+ "base_uri": "https://localhost:8080/"
166
+ },
167
+ "id": "dghWl91B66Ey",
168
+ "outputId": "a14fb7c3-44a7-4d93-805e-708ecc2157ef"
169
+ },
170
+ "outputs": [],
171
+ "source": [
172
+ "history = model.fit(x_train, y_train,\n",
173
+ " epochs=5,\n",
174
+ " batch_size=32,\n",
175
+ " validation_split=0.2,\n",
176
+ " callbacks=[early_stopping],\n",
177
+ " verbose=1)"
178
+ ]
179
+ },
180
+ {
181
+ "cell_type": "code",
182
+ "execution_count": null,
183
+ "metadata": {
184
+ "colab": {
185
+ "base_uri": "https://localhost:8080/",
186
+ "height": 489
187
+ },
188
+ "id": "mU4ISHnR7BIW",
189
+ "outputId": "cbda13b8-4a96-4178-9ee4-f70e07d1bc64"
190
+ },
191
+ "outputs": [],
192
+ "source": [
193
+ "from sklearn.preprocessing import label_binarize\n",
194
+ "\n",
195
+ "y_test_bin = label_binarize(y_test, classes=list(range(10)))\n",
196
+ "y_pred_proba = model.predict(x_test)\n",
197
+ "\n",
198
+ "fpr, tpr, _ = roc_curve(y_test_bin[:, 0], y_pred_proba[:, 0])\n",
199
+ "roc_auc = auc(fpr, tpr)\n",
200
+ "\n",
201
+ "plt.figure()\n",
202
+ "plt.plot(fpr, tpr, color='darkorange', lw=2, label='Class 0 ROC curve (area = %0.2f)' % roc_auc)\n",
203
+ "plt.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')\n",
204
+ "plt.xlim([0.0, 1.0])\n",
205
+ "plt.ylim([0.0, 1.05])\n",
206
+ "plt.xlabel('False Positive Rate')\n",
207
+ "plt.ylabel('True Positive Rate')\n",
208
+ "plt.title('ROC Curve for Class 0')\n",
209
+ "plt.legend(loc=\"lower right\")\n",
210
+ "plt.show()"
211
+ ]
212
+ }
213
+ ],
214
+ "metadata": {
215
+ "colab": {
216
+ "provenance": []
217
+ },
218
+ "kernelspec": {
219
+ "display_name": "Python 3 (ipykernel)",
220
+ "language": "python",
221
+ "name": "python3"
222
+ },
223
+ "language_info": {
224
+ "codemirror_mode": {
225
+ "name": "ipython",
226
+ "version": 3
227
+ },
228
+ "file_extension": ".py",
229
+ "mimetype": "text/x-python",
230
+ "name": "python",
231
+ "nbconvert_exporter": "python",
232
+ "pygments_lexer": "ipython3",
233
+ "version": "3.12.4"
234
+ }
235
+ },
236
+ "nbformat": 4,
237
+ "nbformat_minor": 4
238
+ }