noshot 2.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 (41) 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/ML/Main/5. Logistic Regression (Magic04 Dataset).ipynb +200 -0
  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-2.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-2.0.0.dist-info → noshot-3.0.0.dist-info}/WHEEL +1 -1
  33. noshot/data/ML TS XAI/TS/bill-charge.ipynb +0 -239
  34. noshot/data/ML TS XAI/TS/daily-min-temperatures.ipynb +0 -239
  35. noshot/data/ML TS XAI/TS/data/bill-data.csv +0 -21
  36. noshot/data/ML TS XAI/TS/data/daily-min-temperatures.csv +0 -3651
  37. noshot/data/ML TS XAI/TS/data/monthly-sunspots.csv +0 -2821
  38. noshot/data/ML TS XAI/TS/monthly-sunspots.ipynb +0 -241
  39. noshot-2.0.0.dist-info/RECORD +0 -15
  40. {noshot-2.0.0.dist-info → noshot-3.0.0.dist-info}/licenses/LICENSE.txt +0 -0
  41. {noshot-2.0.0.dist-info → noshot-3.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,153 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "5bafc01f",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import matplotlib.pyplot as plt\n",
12
+ "import seaborn as sns\n",
13
+ "from sklearn.model_selection import train_test_split\n",
14
+ "from sklearn.naive_bayes import GaussianNB\n",
15
+ "from sklearn.metrics import accuracy_score, roc_curve, auc\n",
16
+ "from sklearn.metrics import classification_report, confusion_matrix, ConfusionMatrixDisplay\n",
17
+ "from sklearn.preprocessing import LabelEncoder"
18
+ ]
19
+ },
20
+ {
21
+ "cell_type": "code",
22
+ "execution_count": null,
23
+ "id": "6ef7990c",
24
+ "metadata": {},
25
+ "outputs": [],
26
+ "source": [
27
+ "df = pd.read_csv(\"data/agaricus-lepiota.data\", header=None)\n",
28
+ "df.head()"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "code",
33
+ "execution_count": null,
34
+ "id": "a5e91b36",
35
+ "metadata": {},
36
+ "outputs": [],
37
+ "source": [
38
+ "X = df.drop(columns=[0])\n",
39
+ "X"
40
+ ]
41
+ },
42
+ {
43
+ "cell_type": "code",
44
+ "execution_count": null,
45
+ "id": "eb58da4a",
46
+ "metadata": {},
47
+ "outputs": [],
48
+ "source": [
49
+ "for col in X.columns: \n",
50
+ " X[col] = LabelEncoder().fit_transform(X[col])\n",
51
+ "X"
52
+ ]
53
+ },
54
+ {
55
+ "cell_type": "code",
56
+ "execution_count": null,
57
+ "id": "a4a1e805",
58
+ "metadata": {},
59
+ "outputs": [],
60
+ "source": [
61
+ "y = df[0]\n",
62
+ "y = LabelEncoder().fit_transform(y)\n",
63
+ "y"
64
+ ]
65
+ },
66
+ {
67
+ "cell_type": "code",
68
+ "execution_count": null,
69
+ "id": "114a44f5",
70
+ "metadata": {},
71
+ "outputs": [],
72
+ "source": [
73
+ "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42, stratify=y)\n",
74
+ "nb = GaussianNB()\n",
75
+ "nb.fit(X_train, y_train)"
76
+ ]
77
+ },
78
+ {
79
+ "cell_type": "code",
80
+ "execution_count": null,
81
+ "id": "79e3ed49",
82
+ "metadata": {},
83
+ "outputs": [],
84
+ "source": [
85
+ "y_pred = nb.predict(X_test)\n",
86
+ "print(f\"Accuracy : {accuracy_score(y_test,y_pred)}\")"
87
+ ]
88
+ },
89
+ {
90
+ "cell_type": "code",
91
+ "execution_count": null,
92
+ "id": "f377d0cc",
93
+ "metadata": {},
94
+ "outputs": [],
95
+ "source": [
96
+ "report = classification_report(y_test,y_pred)\n",
97
+ "print(report)"
98
+ ]
99
+ },
100
+ {
101
+ "cell_type": "code",
102
+ "execution_count": null,
103
+ "id": "e42690dc",
104
+ "metadata": {},
105
+ "outputs": [],
106
+ "source": [
107
+ "cm = confusion_matrix(y_test,y_pred)\n",
108
+ "ConfusionMatrixDisplay(cm).plot()"
109
+ ]
110
+ },
111
+ {
112
+ "cell_type": "code",
113
+ "execution_count": null,
114
+ "id": "bd35e7f4",
115
+ "metadata": {},
116
+ "outputs": [],
117
+ "source": [
118
+ "y_pred_proba = nb.predict_proba(X_test)[:,1]\n",
119
+ "fpr, tpr, thresholds = roc_curve(y_test, y_pred_proba) \n",
120
+ "roc_auc = auc(fpr, tpr)\n",
121
+ "\n",
122
+ "plt.plot(fpr, tpr, label='ROC curve (area = %0.2f)' % roc_auc)\n",
123
+ "plt.plot([0, 1], [0, 1], 'k--', label='No Skill')\n",
124
+ "plt.xlabel('False Positive Rate')\n",
125
+ "plt.ylabel('True Positive Rate')\n",
126
+ "plt.title('ROC Curve for Breast Cancer Classification')\n",
127
+ "plt.legend()\n",
128
+ "plt.show()"
129
+ ]
130
+ }
131
+ ],
132
+ "metadata": {
133
+ "kernelspec": {
134
+ "display_name": "Python 3 (ipykernel)",
135
+ "language": "python",
136
+ "name": "python3"
137
+ },
138
+ "language_info": {
139
+ "codemirror_mode": {
140
+ "name": "ipython",
141
+ "version": 3
142
+ },
143
+ "file_extension": ".py",
144
+ "mimetype": "text/x-python",
145
+ "name": "python",
146
+ "nbconvert_exporter": "python",
147
+ "pygments_lexer": "ipython3",
148
+ "version": "3.12.4"
149
+ }
150
+ },
151
+ "nbformat": 4,
152
+ "nbformat_minor": 5
153
+ }
@@ -0,0 +1,89 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "939c616d-2779-4e21-adcf-1d070898d65b",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "from sklearn import datasets\n",
11
+ "from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay\n",
12
+ "from sklearn.model_selection import train_test_split\n",
13
+ "from sklearn.naive_bayes import GaussianNB\n",
14
+ "import pandas as pd"
15
+ ]
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": null,
20
+ "id": "17720a0d-e788-4b1d-b2b2-a542f6b824a2",
21
+ "metadata": {},
22
+ "outputs": [],
23
+ "source": [
24
+ "wine = pd.read_csv('data/wine-dataset.csv')\n",
25
+ "print(wine.shape)"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": null,
31
+ "id": "a050923e-4382-4ff7-93bf-446b117c0ef5",
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "X = wine.iloc[:, :13]\n",
36
+ "X.head()"
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": null,
42
+ "id": "9f1a4355-718e-40ed-b892-3e3d03c4ef3c",
43
+ "metadata": {},
44
+ "outputs": [],
45
+ "source": [
46
+ "y = wine.iloc[:, 13]\n",
47
+ "y"
48
+ ]
49
+ },
50
+ {
51
+ "cell_type": "code",
52
+ "execution_count": null,
53
+ "id": "dd3f31ef-c0d2-48dd-9fb7-338c10f9fbf9",
54
+ "metadata": {},
55
+ "outputs": [],
56
+ "source": [
57
+ "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state = 0)\n",
58
+ "\n",
59
+ "gnb = GaussianNB().fit(X_train, y_train)\n",
60
+ "gnb_predictions = gnb.predict(X_test)\n",
61
+ "accuracy = gnb.score(X_test, y_test)\n",
62
+ "accuracy\n",
63
+ "cm = confusion_matrix(y_test, gnb_predictions)\n",
64
+ "ConfusionMatrixDisplay(cm).plot()"
65
+ ]
66
+ }
67
+ ],
68
+ "metadata": {
69
+ "kernelspec": {
70
+ "display_name": "Python 3 (ipykernel)",
71
+ "language": "python",
72
+ "name": "python3"
73
+ },
74
+ "language_info": {
75
+ "codemirror_mode": {
76
+ "name": "ipython",
77
+ "version": 3
78
+ },
79
+ "file_extension": ".py",
80
+ "mimetype": "text/x-python",
81
+ "name": "python",
82
+ "nbconvert_exporter": "python",
83
+ "pygments_lexer": "ipython3",
84
+ "version": "3.12.4"
85
+ }
86
+ },
87
+ "nbformat": 4,
88
+ "nbformat_minor": 5
89
+ }
@@ -0,0 +1,208 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "30043339",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import numpy as np\n",
12
+ "import seaborn as sns\n",
13
+ "import matplotlib.pyplot as plt\n",
14
+ "\n",
15
+ "from sklearn.model_selection import train_test_split\n",
16
+ "from sklearn.metrics import accuracy_score\n",
17
+ "from sklearn.preprocessing import MinMaxScaler\n",
18
+ "from sklearn.decomposition import PCA\n",
19
+ "from sklearn import svm\n",
20
+ "from sklearn.svm import SVC\n",
21
+ "from scipy.io import arff"
22
+ ]
23
+ },
24
+ {
25
+ "cell_type": "code",
26
+ "execution_count": null,
27
+ "id": "74c26fca",
28
+ "metadata": {},
29
+ "outputs": [],
30
+ "source": [
31
+ "data = arff.loadarff(\"data/rice.arff\")\n",
32
+ "df = pd.DataFrame(data[0])\n",
33
+ "df.head()"
34
+ ]
35
+ },
36
+ {
37
+ "cell_type": "code",
38
+ "execution_count": null,
39
+ "id": "51439c01",
40
+ "metadata": {},
41
+ "outputs": [],
42
+ "source": [
43
+ "df.info()"
44
+ ]
45
+ },
46
+ {
47
+ "cell_type": "code",
48
+ "execution_count": null,
49
+ "id": "03e7a5d4",
50
+ "metadata": {},
51
+ "outputs": [],
52
+ "source": [
53
+ "df['Class'].unique()"
54
+ ]
55
+ },
56
+ {
57
+ "cell_type": "code",
58
+ "execution_count": null,
59
+ "id": "cf14dcf8",
60
+ "metadata": {},
61
+ "outputs": [],
62
+ "source": [
63
+ "df['Class'] = df['Class'].map({b'Cammeo':0, b'Osmancik':1})\n",
64
+ "df['Class'].unique()"
65
+ ]
66
+ },
67
+ {
68
+ "cell_type": "code",
69
+ "execution_count": null,
70
+ "id": "dba18b10",
71
+ "metadata": {},
72
+ "outputs": [],
73
+ "source": [
74
+ "df.isnull().sum()"
75
+ ]
76
+ },
77
+ {
78
+ "cell_type": "code",
79
+ "execution_count": null,
80
+ "id": "246346b1",
81
+ "metadata": {},
82
+ "outputs": [],
83
+ "source": [
84
+ "X = df.drop(columns=['Class'])\n",
85
+ "y = df['Class']"
86
+ ]
87
+ },
88
+ {
89
+ "cell_type": "code",
90
+ "execution_count": null,
91
+ "id": "d182a204",
92
+ "metadata": {},
93
+ "outputs": [],
94
+ "source": [
95
+ "X = PCA(n_components=2).fit_transform(X)"
96
+ ]
97
+ },
98
+ {
99
+ "cell_type": "code",
100
+ "execution_count": null,
101
+ "id": "f8e67728",
102
+ "metadata": {},
103
+ "outputs": [],
104
+ "source": [
105
+ "X.shape"
106
+ ]
107
+ },
108
+ {
109
+ "cell_type": "code",
110
+ "execution_count": null,
111
+ "id": "99facee4",
112
+ "metadata": {},
113
+ "outputs": [],
114
+ "source": [
115
+ "plt.scatter(X[:,0], X[:,1], c=y, edgecolor=\"black\")\n",
116
+ "plt.show()"
117
+ ]
118
+ },
119
+ {
120
+ "cell_type": "code",
121
+ "execution_count": null,
122
+ "id": "23da86fe-1c5d-4f57-ab29-a2bb6b060783",
123
+ "metadata": {},
124
+ "outputs": [],
125
+ "source": [
126
+ "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)"
127
+ ]
128
+ },
129
+ {
130
+ "cell_type": "code",
131
+ "execution_count": null,
132
+ "id": "903cccff",
133
+ "metadata": {},
134
+ "outputs": [],
135
+ "source": [
136
+ "models=[\n",
137
+ " SVC(kernel='linear', C=1, degree=5, gamma=\"auto\", probability=True),\n",
138
+ " SVC(kernel='rbf', C=1, gamma='scale', probability=True),\n",
139
+ " SVC(kernel='poly', C=1, degree=5, gamma=\"auto\", probability=True)\n",
140
+ "]"
141
+ ]
142
+ },
143
+ {
144
+ "cell_type": "code",
145
+ "execution_count": null,
146
+ "id": "ff7b81e7",
147
+ "metadata": {},
148
+ "outputs": [],
149
+ "source": [
150
+ "from sklearn.preprocessing import StandardScaler\n",
151
+ "from sklearn.pipeline import make_pipeline\n",
152
+ "from sklearn.metrics import classification_report,confusion_matrix,ConfusionMatrixDisplay\n",
153
+ "from sklearn.metrics import roc_curve, auc\n",
154
+ "from mlxtend.plotting import plot_decision_regions\n",
155
+ "\n",
156
+ "for model in models:\n",
157
+ " nonlinear_svm = make_pipeline(StandardScaler(), model)\n",
158
+ " nonlinear_svm.fit(X_train, y_train)\n",
159
+ " y_pred = nonlinear_svm.predict(X_test)\n",
160
+ " print(\"SVM Classification Report:\")\n",
161
+ " print(classification_report(y_test, y_pred))\n",
162
+ " print(f\"Accuracy: {accuracy_score(y_test, y_pred):.2f}\")\n",
163
+ " plot_decision_regions(X=X_train, \n",
164
+ " y=y_train.values,\n",
165
+ " clf=nonlinear_svm, \n",
166
+ " legend=2)\n",
167
+ "\n",
168
+ " plt.title('SVM Decision Region Boundary', size=16)\n",
169
+ " plt.show()\n",
170
+ " conf=confusion_matrix(y_test,y_pred)\n",
171
+ " ConfusionMatrixDisplay(conf,display_labels=[0,1]).plot(cmap='Blues')\n",
172
+ " plt.show()\n",
173
+ " y_pred_proba=nonlinear_svm.predict_proba(X_test)[:,1]\n",
174
+ " fpr, tpr, thresholds = roc_curve(y_test, y_pred_proba) \n",
175
+ " roc_auc = auc(fpr, tpr)\n",
176
+ " \n",
177
+ " plt.plot(fpr, tpr, label='ROC curve (area = %0.2f)' % roc_auc)\n",
178
+ " plt.plot([0, 1], [0, 1], 'k--', label='No Skill')\n",
179
+ " plt.xlabel('False Positive Rate')\n",
180
+ " plt.ylabel('True Positive Rate')\n",
181
+ " plt.title('ROC Curve for Rice Classification')\n",
182
+ " plt.legend()\n",
183
+ " plt.show()"
184
+ ]
185
+ }
186
+ ],
187
+ "metadata": {
188
+ "kernelspec": {
189
+ "display_name": "Python 3 (ipykernel)",
190
+ "language": "python",
191
+ "name": "python3"
192
+ },
193
+ "language_info": {
194
+ "codemirror_mode": {
195
+ "name": "ipython",
196
+ "version": 3
197
+ },
198
+ "file_extension": ".py",
199
+ "mimetype": "text/x-python",
200
+ "name": "python",
201
+ "nbconvert_exporter": "python",
202
+ "pygments_lexer": "ipython3",
203
+ "version": "3.12.4"
204
+ }
205
+ },
206
+ "nbformat": 4,
207
+ "nbformat_minor": 5
208
+ }