noshot 10.0.0__py3-none-any.whl → 12.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 (74) hide show
  1. noshot/data/DLE FSD BDA/DLE/1. DNN (Image Classification).ipynb +389 -0
  2. noshot/data/DLE FSD BDA/DLE/2. DNN vs CNN.ipynb +516 -0
  3. noshot/data/DLE FSD BDA/DLE/3. CNN (Object Detecrion).ipynb +259 -0
  4. noshot/data/DLE FSD BDA/DLE/4. FCN (Image Segmentaion).ipynb +274 -0
  5. noshot/main.py +3 -3
  6. {noshot-10.0.0.dist-info → noshot-12.0.0.dist-info}/METADATA +1 -1
  7. noshot-12.0.0.dist-info/RECORD +13 -0
  8. {noshot-10.0.0.dist-info → noshot-12.0.0.dist-info}/WHEEL +1 -1
  9. noshot/data/ML TS XAI/ML/CNN(Image_for_Folders_5).ipynb +0 -201
  10. noshot/data/ML TS XAI/ML/CNN(Image_form_Folder_2).ipynb +0 -201
  11. noshot/data/ML TS XAI/ML/Json Codes/ML LAB CIA 2.ipynb +0 -409
  12. noshot/data/ML TS XAI/ML/ML 1/1. EDA-PCA (Balance Scale Dataset).ipynb +0 -147
  13. noshot/data/ML TS XAI/ML/ML 1/1. EDA-PCA (Rice Dataset).ipynb +0 -181
  14. noshot/data/ML TS XAI/ML/ML 1/10. HMM Veterbi.ipynb +0 -152
  15. noshot/data/ML TS XAI/ML/ML 1/2. KNN (Balance Scale Dataset).ipynb +0 -117
  16. noshot/data/ML TS XAI/ML/ML 1/2. KNN (Iris Dataset).ipynb +0 -156
  17. noshot/data/ML TS XAI/ML/ML 1/2. KNN (Sobar-72 Dataset).ipynb +0 -215
  18. noshot/data/ML TS XAI/ML/ML 1/3. LDA (Balance Scale Dataset).ipynb +0 -78
  19. noshot/data/ML TS XAI/ML/ML 1/3. LDA (NPHA Doctor Visits Dataset).ipynb +0 -114
  20. noshot/data/ML TS XAI/ML/ML 1/4. Linear Regression (Machine Dataset).ipynb +0 -115
  21. noshot/data/ML TS XAI/ML/ML 1/4. Linear Regression (Real Estate Dataset).ipynb +0 -146
  22. noshot/data/ML TS XAI/ML/ML 1/5. Logistic Regression (Magic04 Dataset).ipynb +0 -130
  23. noshot/data/ML TS XAI/ML/ML 1/5. Logistic Regression (Wine Dataset).ipynb +0 -112
  24. noshot/data/ML TS XAI/ML/ML 1/6. Naive Bayes Classifier (Agaricus Lepiota Dataset).ipynb +0 -118
  25. noshot/data/ML TS XAI/ML/ML 1/6. Naive Bayes Classifier (Wine Dataset).ipynb +0 -89
  26. noshot/data/ML TS XAI/ML/ML 1/7. SVM (Rice Dataset).ipynb +0 -120
  27. noshot/data/ML TS XAI/ML/ML 1/8. FeedForward NN (Sobar72 Dataset).ipynb +0 -262
  28. noshot/data/ML TS XAI/ML/ML 1/9. CNN (Cifar10 Dataset).ipynb +0 -156
  29. noshot/data/ML TS XAI/ML/ML 2/1. PCA.ipynb +0 -162
  30. noshot/data/ML TS XAI/ML/ML 2/10. CNN.ipynb +0 -100
  31. noshot/data/ML TS XAI/ML/ML 2/11. HMM.ipynb +0 -336
  32. noshot/data/ML TS XAI/ML/ML 2/2. KNN.ipynb +0 -149
  33. noshot/data/ML TS XAI/ML/ML 2/3. LDA.ipynb +0 -132
  34. noshot/data/ML TS XAI/ML/ML 2/4. Linear Regression.ipynb +0 -86
  35. noshot/data/ML TS XAI/ML/ML 2/5. Logistic Regression.ipynb +0 -115
  36. noshot/data/ML TS XAI/ML/ML 2/6. Naive Bayes (Titanic).ipynb +0 -196
  37. noshot/data/ML TS XAI/ML/ML 2/6. Naive Bayes (Wine).ipynb +0 -98
  38. noshot/data/ML TS XAI/ML/ML 2/7. SVM Linear.ipynb +0 -109
  39. noshot/data/ML TS XAI/ML/ML 2/8. SVM Non-Linear.ipynb +0 -195
  40. noshot/data/ML TS XAI/ML/ML 2/9. FNN With Regularization.ipynb +0 -189
  41. noshot/data/ML TS XAI/ML/ML 2/9. FNN Without Regularization.ipynb +0 -197
  42. noshot/data/ML TS XAI/ML/ML 2/All in One Lab CIA 1 Q.ipynb +0 -1087
  43. noshot/data/ML TS XAI/ML/ML 3 (Latest)/1. PCA EDA.ipynb +0 -274
  44. noshot/data/ML TS XAI/ML/ML 3 (Latest)/10. CNN.ipynb +0 -170
  45. noshot/data/ML TS XAI/ML/ML 3 (Latest)/11. HMM 2.ipynb +0 -1087
  46. noshot/data/ML TS XAI/ML/ML 3 (Latest)/11. HMM 3.ipynb +0 -178
  47. noshot/data/ML TS XAI/ML/ML 3 (Latest)/11. HMM 4.ipynb +0 -185
  48. noshot/data/ML TS XAI/ML/ML 3 (Latest)/11. HMM.ipynb +0 -106
  49. noshot/data/ML TS XAI/ML/ML 3 (Latest)/2. KNN.ipynb +0 -177
  50. noshot/data/ML TS XAI/ML/ML 3 (Latest)/3. LDA.ipynb +0 -195
  51. noshot/data/ML TS XAI/ML/ML 3 (Latest)/4. Linear Regression.ipynb +0 -267
  52. noshot/data/ML TS XAI/ML/ML 3 (Latest)/5. Logistic Regression.ipynb +0 -104
  53. noshot/data/ML TS XAI/ML/ML 3 (Latest)/6. Bayesian Classifier.ipynb +0 -109
  54. noshot/data/ML TS XAI/ML/ML 3 (Latest)/7. SVM.ipynb +0 -220
  55. noshot/data/ML TS XAI/ML/ML 3 (Latest)/8. MLP.ipynb +0 -99
  56. noshot/data/ML TS XAI/ML/ML 3 (Latest)/9. Ridge - Lasso.ipynb +0 -211
  57. noshot/data/ML TS XAI/ML/ML 3 (Latest)/9. Ridge Lasso 2.ipynb +0 -99
  58. noshot/data/ML TS XAI/ML/ML 3 (Latest)/Image Load Example.ipynb +0 -118
  59. noshot/data/ML TS XAI/ML/ML 3 (Latest)/Updated_Untitled.ipynb +0 -603
  60. noshot/data/ML TS XAI/ML/ML Lab AllinOne.ipynb +0 -961
  61. noshot/data/ML TS XAI/ML/ML Lab H Sec/1. Iris Dataset (Softmax vs Sigmoid).ipynb +0 -231
  62. noshot/data/ML TS XAI/ML/ML Lab H Sec/2. Student Dataset (Overfit vs Regularized).ipynb +0 -269
  63. noshot/data/ML TS XAI/ML/ML Lab H Sec/3. Insurance Target Categorical (Overfit vs Regularized).ipynb +0 -274
  64. noshot/data/ML TS XAI/ML/ML Lab H Sec/3. Insurance Target Numerical (Overfit vs Regularized).ipynb +0 -263
  65. noshot/data/ML TS XAI/ML/ML Lab H Sec/4. Smart House System HMM.ipynb +0 -198
  66. noshot/data/ML TS XAI/ML/ML Lab H Sec/5. Fraud Detection System HMM.ipynb +0 -201
  67. noshot/data/ML TS XAI/ML/ML Lab H Sec/insurance.csv +0 -1339
  68. noshot/data/ML TS XAI/ML/ML Lab H Sec/iris1.data +0 -151
  69. noshot/data/ML TS XAI/ML/ML Lab H Sec/student-mat.csv +0 -396
  70. noshot/data/ML TS XAI/ML/ML Lab H Sec/student-por.csv +0 -650
  71. noshot/data/ML TS XAI/ML/Rolls Royce AllinOne.ipynb +0 -691
  72. noshot-10.0.0.dist-info/RECORD +0 -72
  73. {noshot-10.0.0.dist-info → noshot-12.0.0.dist-info}/licenses/LICENSE.txt +0 -0
  74. {noshot-10.0.0.dist-info → noshot-12.0.0.dist-info}/top_level.txt +0 -0
@@ -1,86 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "id": "cb7109b3-2133-4346-99cd-af7ed09252be",
7
- "metadata": {},
8
- "outputs": [],
9
- "source": [
10
- "import sys\n",
11
- "import pandas as pd\n",
12
- "df2 = pd.read_csv (\"E:/126156055/dataset4.csv\")\n",
13
- "df2.to_csv ('machine.csv', index=None)\n",
14
- "x=df2.iloc[:,3:4].values\n",
15
- "y=df2.iloc[:,8].values\n",
16
- "\n",
17
- "\n",
18
- "from sklearn.model_selection import train_test_split\n",
19
- "X_train, X_test, y_train, y_test = train_test_split(x, y, test_size = 0.2,\n",
20
- "random_state = 0)\n",
21
- "from sklearn.linear_model import LinearRegression\n",
22
- "regressor = LinearRegression()\n",
23
- "regressor.fit(X_train, y_train)\n",
24
- "#LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None,normalize=False)\n",
25
- "y_pred = regressor.predict(X_test)\n",
26
- "y_pred_train = regressor.predict(X_train)\n",
27
- "print(\"Model Score: \", regressor.score(X_test, y_test))\n",
28
- "from sklearn.metrics import r2_score\n",
29
- "print(\"R_square score: \", r2_score(y_test,y_pred))\n",
30
- "import matplotlib.pyplot as plt\n",
31
- "plt.scatter(X_train, y_train, color = 'red')\n",
32
- "plt.plot(X_train, regressor.predict(X_train), color = 'blue')\n",
33
- "plt.title('Y vs X (Training set)')\n",
34
- "plt.xlabel('X')\n",
35
- "plt.ylabel('Y')\n",
36
- "plt.show()\n",
37
- "plt.scatter(X_test, y_test, color = 'red')\n",
38
- "plt.plot(X_train, regressor.predict(X_train), color = 'blue')\n",
39
- "plt.title('Y vs X (Test set)')\n",
40
- "plt.xlabel('X')\n",
41
- "\n",
42
- "\n",
43
- "plt.ylabel('Y')\n",
44
- "plt.show()\n",
45
- "X_future_expereince = [[2],[4]]\n",
46
- "print (\"Prediction :\", regressor.predict(X_future_expereince))\n",
47
- "plt.scatter(X_future_expereince, regressor.predict(X_future_expereince),\n",
48
- "color = 'red')\n",
49
- "plt.plot(X_train, regressor.predict(X_train), color = 'blue')\n",
50
- "plt.title('Y vs X (Test set)')\n",
51
- "plt.xlabel('X')\n",
52
- "plt.ylabel('Y')\n",
53
- "plt.show()"
54
- ]
55
- },
56
- {
57
- "cell_type": "code",
58
- "execution_count": null,
59
- "id": "a39458d3-d8b7-44c9-8dfd-931a004a898a",
60
- "metadata": {},
61
- "outputs": [],
62
- "source": []
63
- }
64
- ],
65
- "metadata": {
66
- "kernelspec": {
67
- "display_name": "Python 3 (ipykernel)",
68
- "language": "python",
69
- "name": "python3"
70
- },
71
- "language_info": {
72
- "codemirror_mode": {
73
- "name": "ipython",
74
- "version": 3
75
- },
76
- "file_extension": ".py",
77
- "mimetype": "text/x-python",
78
- "name": "python",
79
- "nbconvert_exporter": "python",
80
- "pygments_lexer": "ipython3",
81
- "version": "3.12.4"
82
- }
83
- },
84
- "nbformat": 4,
85
- "nbformat_minor": 5
86
- }
@@ -1,115 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "id": "a305f157-3894-4887-a6e7-8f62d4269f69",
7
- "metadata": {},
8
- "outputs": [],
9
- "source": [
10
- "from sklearn import linear_model,datasets\n",
11
- "from sklearn.model_selection import train_test_split\n",
12
- "from sklearn.metrics import confusion_matrix\n",
13
- "import numpy as np\n",
14
- "import matplotlib.pyplot as plt\n",
15
- "import itertools"
16
- ]
17
- },
18
- {
19
- "cell_type": "code",
20
- "execution_count": null,
21
- "id": "edf3ad16-3eab-47e8-9424-155e2702f607",
22
- "metadata": {},
23
- "outputs": [],
24
- "source": [
25
- "win = datasets.load_wine()\n",
26
- "type(win)\n",
27
- "win.data[:5,:]"
28
- ]
29
- },
30
- {
31
- "cell_type": "code",
32
- "execution_count": null,
33
- "id": "1070132c-d4c7-474d-b569-481b63209e84",
34
- "metadata": {},
35
- "outputs": [],
36
- "source": [
37
- "print(type(win.feature_names))\n",
38
- "win.feature_names\n",
39
- "X_train,X_test,y_train,y_test =train_test_split(win.data,win.target,test_size=0.30,random_state=7)"
40
- ]
41
- },
42
- {
43
- "cell_type": "code",
44
- "execution_count": null,
45
- "id": "9b53bde4-67e3-45ff-a733-5d4856cc8a6a",
46
- "metadata": {},
47
- "outputs": [],
48
- "source": [
49
- "log_reg_model = linear_model.LogisticRegression()\n",
50
- "log_reg_model.fit(X_train,y_train)\n",
51
- "log_reg_base_score = log_reg_model.score(X_test,y_test)\n",
52
- "print(\"The score for the Logistic Regression Model is : \",log_reg_base_score)"
53
- ]
54
- },
55
- {
56
- "cell_type": "code",
57
- "execution_count": null,
58
- "id": "f9f0c932-0ea8-4c0d-9c09-fdf14b6b10d2",
59
- "metadata": {},
60
- "outputs": [],
61
- "source": [
62
- "cm = confusion_matrix(y_test,log_reg_model.predict(X_test))\n",
63
- "print(cm)\n",
64
- "X = win.data[:,:2]\n",
65
- "Y = win.target\n",
66
- "log_reg_model.fit(X,Y)\n",
67
- "x_min, x_max = X[:, 0].min() - .5, X[:, 0].max() + .5\n",
68
- "y_min, y_max = X[:, 1].min() - .5, X[:, 1].max() + .5\n",
69
- "xx, yy = np.meshgrid(np.arange(x_min, x_max, .01), np.arange(y_min, y_max,\n",
70
- ".01))\n",
71
- "Z = log_reg_model.predict(np.c_[xx.ravel(), yy.ravel()])\n",
72
- "Z = Z.reshape(xx.shape)\n",
73
- "plt.figure(1, figsize=(4, 3))\n",
74
- "plt.pcolormesh(xx, yy, Z, cmap=plt.cm.Paired)\n",
75
- "plt.scatter(X[:, 0], X[:, 1], c=Y, edgecolors='k', cmap=plt.cm.Paired)\n",
76
- "plt.xlabel('X')\n",
77
- "plt.ylabel('Y')\n",
78
- "plt.xlim(xx.min(), xx.max())\n",
79
- "plt.ylim(yy.min(), yy.max())\n",
80
- "plt.xticks(())\n",
81
- "plt.yticks(())\n",
82
- "plt.show()"
83
- ]
84
- },
85
- {
86
- "cell_type": "code",
87
- "execution_count": null,
88
- "id": "4739ed30-654d-4b0f-82eb-fafa8cf857d7",
89
- "metadata": {},
90
- "outputs": [],
91
- "source": []
92
- }
93
- ],
94
- "metadata": {
95
- "kernelspec": {
96
- "display_name": "Python 3 (ipykernel)",
97
- "language": "python",
98
- "name": "python3"
99
- },
100
- "language_info": {
101
- "codemirror_mode": {
102
- "name": "ipython",
103
- "version": 3
104
- },
105
- "file_extension": ".py",
106
- "mimetype": "text/x-python",
107
- "name": "python",
108
- "nbconvert_exporter": "python",
109
- "pygments_lexer": "ipython3",
110
- "version": "3.12.4"
111
- }
112
- },
113
- "nbformat": 4,
114
- "nbformat_minor": 5
115
- }
@@ -1,196 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "markdown",
5
- "metadata": {
6
- "id": "ZiSQi85mwJak"
7
- },
8
- "source": [
9
- "## ***Reqiuired Packages***"
10
- ]
11
- },
12
- {
13
- "cell_type": "code",
14
- "execution_count": null,
15
- "metadata": {
16
- "executionInfo": {
17
- "elapsed": 6,
18
- "status": "ok",
19
- "timestamp": 1740466961205,
20
- "user": {
21
- "displayName": "Jaison A",
22
- "userId": "07006398627763032071"
23
- },
24
- "user_tz": -330
25
- },
26
- "id": "s0sHSKMhwF4e"
27
- },
28
- "outputs": [],
29
- "source": [
30
- "import pandas as pd\n",
31
- "import numpy as np\n",
32
- "from sklearn.model_selection import train_test_split\n",
33
- "from sklearn.metrics import confusion_matrix\n",
34
- "from sklearn.preprocessing import LabelEncoder\n"
35
- ]
36
- },
37
- {
38
- "cell_type": "markdown",
39
- "metadata": {
40
- "id": "xNrDbVDgwSc0"
41
- },
42
- "source": [
43
- "## ***Load Dataset***"
44
- ]
45
- },
46
- {
47
- "cell_type": "code",
48
- "execution_count": null,
49
- "metadata": {
50
- "colab": {
51
- "base_uri": "https://localhost:8080/"
52
- },
53
- "executionInfo": {
54
- "elapsed": 1905,
55
- "status": "ok",
56
- "timestamp": 1740466963116,
57
- "user": {
58
- "displayName": "Jaison A",
59
- "userId": "07006398627763032071"
60
- },
61
- "user_tz": -330
62
- },
63
- "id": "MtmRoNj4wYOr",
64
- "outputId": "0dc7b706-181e-4bb2-f37e-9fd1f7220c51"
65
- },
66
- "outputs": [],
67
- "source": [
68
- "from google.colab import drive\n",
69
- "drive.mount('/content/drive')"
70
- ]
71
- },
72
- {
73
- "cell_type": "markdown",
74
- "metadata": {
75
- "id": "_lLnxu9a4vsX"
76
- },
77
- "source": [
78
- "## ***Create Input Data and Output Data***"
79
- ]
80
- },
81
- {
82
- "cell_type": "code",
83
- "execution_count": null,
84
- "metadata": {
85
- "colab": {
86
- "base_uri": "https://localhost:8080/",
87
- "height": 1000
88
- },
89
- "executionInfo": {
90
- "elapsed": 123,
91
- "status": "ok",
92
- "timestamp": 1740466963241,
93
- "user": {
94
- "displayName": "Jaison A",
95
- "userId": "07006398627763032071"
96
- },
97
- "user_tz": -330
98
- },
99
- "id": "g99uRIRSxLer",
100
- "outputId": "250bfcff-a08d-420a-b72d-c297f9108cb2"
101
- },
102
- "outputs": [],
103
- "source": [
104
- "data=pd.read_csv('/content/drive/MyDrive/sem 6/Lab/ML Lab/Lab 6/titanic.csv')\n",
105
- "display(data.head())\n",
106
- "\n",
107
- "\n",
108
- "inputs=data.get(['Pclass','Sex','Age','SibSp','Fare','Cabin','Parch'])\n",
109
- "\n",
110
- "\n",
111
- "inputs['Sex'].replace(['male','female'],[1,2],inplace=True)\n",
112
- "\n",
113
- "le=LabelEncoder()\n",
114
- "inputs['Cabin']=le.fit_transform(inputs['Cabin'].astype(str))\n",
115
- "#inputs['Embarked']=le.fit_transform(inputs['Embarked'].astype(str))\n",
116
- "inputs['Age'].fillna(inputs['Age'].mean(),inplace=True)\n",
117
- "inputs['Cabin'].fillna(inputs['Cabin'].mean(),inplace=True)\n",
118
- "#inputs['Embarked'].fillna(inputs['Embarked'].mean(),inplace=True)\n",
119
- "display(inputs.head())\n",
120
- "\n",
121
- "\n",
122
- "targets=data.get(['Survived'])\n",
123
- "display(targets)"
124
- ]
125
- },
126
- {
127
- "cell_type": "markdown",
128
- "metadata": {
129
- "id": "xRVUOPSQ41xw"
130
- },
131
- "source": [
132
- "## ***Perform Naive Bayes***"
133
- ]
134
- },
135
- {
136
- "cell_type": "code",
137
- "execution_count": null,
138
- "metadata": {
139
- "colab": {
140
- "base_uri": "https://localhost:8080/"
141
- },
142
- "executionInfo": {
143
- "elapsed": 9,
144
- "status": "ok",
145
- "timestamp": 1740466963249,
146
- "user": {
147
- "displayName": "Jaison A",
148
- "userId": "07006398627763032071"
149
- },
150
- "user_tz": -330
151
- },
152
- "id": "fjoKWEbI4e_H",
153
- "outputId": "a5bb1d20-21ea-4f32-9c46-5a2f91abee91"
154
- },
155
- "outputs": [],
156
- "source": [
157
- "X=inputs\n",
158
- "y=targets\n",
159
- "\n",
160
- "X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=0.3, random_state =42)\n",
161
- "from sklearn.naive_bayes import GaussianNB\n",
162
- "gnb = GaussianNB().fit(X_train, y_train)\n",
163
- "gnb_predictions = gnb.predict(X_test)\n",
164
- "accuracy = gnb.score(X_test, y_test)\n",
165
- "print(f'Accuracy : {accuracy}')\n",
166
- "cm = confusion_matrix(y_test, gnb_predictions)\n",
167
- "print(f'\\n\\nConfusion Matrix : \\n{cm}')"
168
- ]
169
- }
170
- ],
171
- "metadata": {
172
- "colab": {
173
- "authorship_tag": "ABX9TyP8FfIQ/MJ/dOh6Q/ByMUQd",
174
- "provenance": []
175
- },
176
- "kernelspec": {
177
- "display_name": "Python 3 (ipykernel)",
178
- "language": "python",
179
- "name": "python3"
180
- },
181
- "language_info": {
182
- "codemirror_mode": {
183
- "name": "ipython",
184
- "version": 3
185
- },
186
- "file_extension": ".py",
187
- "mimetype": "text/x-python",
188
- "name": "python",
189
- "nbconvert_exporter": "python",
190
- "pygments_lexer": "ipython3",
191
- "version": "3.12.4"
192
- }
193
- },
194
- "nbformat": 4,
195
- "nbformat_minor": 4
196
- }
@@ -1,98 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "metadata": {
7
- "colab": {
8
- "base_uri": "https://localhost:8080/",
9
- "height": 468
10
- },
11
- "executionInfo": {
12
- "elapsed": 35,
13
- "status": "ok",
14
- "timestamp": 1740464645333,
15
- "user": {
16
- "displayName": "Jaison A",
17
- "userId": "07006398627763032071"
18
- },
19
- "user_tz": -330
20
- },
21
- "id": "v_4SXAGau-F-",
22
- "outputId": "a4d3c4c5-4e90-4d7c-d82e-743600472c63"
23
- },
24
- "outputs": [],
25
- "source": [
26
- "from sklearn import datasets\n",
27
- "from sklearn.metrics import confusion_matrix\n",
28
- "from sklearn.model_selection import train_test_split\n",
29
- "win = datasets.load_wine()\n",
30
- "X = win.data\n",
31
- "display(X)\n",
32
- "y = win.target\n",
33
- "display(y)\n",
34
- "\n",
35
- "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state =0)\n",
36
- "from sklearn.naive_bayes import GaussianNB\n",
37
- "gnb = GaussianNB().fit(X_train, y_train)\n",
38
- "gnb_predictions = gnb.predict(X_test)\n",
39
- "accuracy = gnb.score(X_test, y_test)\n",
40
- "display(accuracy)\n",
41
- "cm = confusion_matrix(y_test, gnb_predictions)\n",
42
- "print(cm)"
43
- ]
44
- },
45
- {
46
- "cell_type": "code",
47
- "execution_count": null,
48
- "metadata": {
49
- "colab": {
50
- "base_uri": "https://localhost:8080/",
51
- "height": 989
52
- },
53
- "executionInfo": {
54
- "elapsed": 50,
55
- "status": "ok",
56
- "timestamp": 1740464655299,
57
- "user": {
58
- "displayName": "Jaison A",
59
- "userId": "07006398627763032071"
60
- },
61
- "user_tz": -330
62
- },
63
- "id": "EhHE3W9Rxlrr",
64
- "outputId": "cdb28b95-d0b8-496a-97c8-59190599363f"
65
- },
66
- "outputs": [],
67
- "source": [
68
- "win=datasets.load_wine()\n",
69
- "display(win)"
70
- ]
71
- }
72
- ],
73
- "metadata": {
74
- "colab": {
75
- "authorship_tag": "ABX9TyMW6RGa7T9gSVJv4lb9rc4X",
76
- "provenance": []
77
- },
78
- "kernelspec": {
79
- "display_name": "Python 3 (ipykernel)",
80
- "language": "python",
81
- "name": "python3"
82
- },
83
- "language_info": {
84
- "codemirror_mode": {
85
- "name": "ipython",
86
- "version": 3
87
- },
88
- "file_extension": ".py",
89
- "mimetype": "text/x-python",
90
- "name": "python",
91
- "nbconvert_exporter": "python",
92
- "pygments_lexer": "ipython3",
93
- "version": "3.12.4"
94
- }
95
- },
96
- "nbformat": 4,
97
- "nbformat_minor": 4
98
- }
@@ -1,109 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "metadata": {
7
- "colab": {
8
- "base_uri": "https://localhost:8080/",
9
- "height": 1000
10
- },
11
- "executionInfo": {
12
- "elapsed": 14185,
13
- "status": "ok",
14
- "timestamp": 1743393909812,
15
- "user": {
16
- "displayName": "Jaison A",
17
- "userId": "07006398627763032071"
18
- },
19
- "user_tz": -330
20
- },
21
- "id": "TLczBA7kx_ck",
22
- "outputId": "062f709d-6dab-4287-b47a-75e93d3aa086"
23
- },
24
- "outputs": [],
25
- "source": [
26
- "import pandas as pd\n",
27
- "import numpy as np\n",
28
- "import matplotlib.pyplot as plt\n",
29
- "from sklearn.model_selection import train_test_split\n",
30
- "from sklearn.preprocessing import StandardScaler\n",
31
- "from sklearn.svm import SVC\n",
32
- "from sklearn.decomposition import PCA\n",
33
- "from sklearn.metrics import classification_report, accuracy_score,confusion_matrix, ConfusionMatrixDisplay\n",
34
- "\n",
35
- "df =pd.read_csv('/content/heart_disease_uci.csv')\n",
36
- "print(df.isnull().sum())\n",
37
- "\n",
38
- "for col in df.columns:\n",
39
- " if df[col].dtype == 'object':\n",
40
- " df[col].fillna(df[col].mode()[0], inplace=True)\n",
41
- " else:\n",
42
- " df[col].fillna(df[col].mean(), inplace=True)\n",
43
- "\n",
44
- "df = pd.get_dummies(df, drop_first=True)\n",
45
- "X = df.drop('num', axis=1)\n",
46
- "y = df['num']\n",
47
- "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
48
- "scaler = StandardScaler()\n",
49
- "X_train = scaler.fit_transform(X_train)\n",
50
- "X_test = scaler.transform(X_test)\n",
51
- "\n",
52
- "# Reduce to 2D using PCA\n",
53
- "pca = PCA(n_components=2)\n",
54
- "X_train_2d = pca.fit_transform(X_train)\n",
55
- "X_test_2d = pca.transform(X_test)\n",
56
- "\n",
57
- "# Train SVM on 2D data\n",
58
- "svm_model = SVC(kernel='linear')\n",
59
- "svm_model.fit(X_train_2d, y_train)\n",
60
- "y_pred = svm_model.predict(X_test_2d)\n",
61
- "print(\"Classification Report:\")\n",
62
- "print(classification_report(y_test, y_pred))\n",
63
- "print(\"Accuracy Score:\", accuracy_score(y_test, y_pred))\n",
64
- "ConfusionMatrixDisplay(confusion_matrix(y_test, y_pred)).plot()\n",
65
- "plt.show()\n",
66
- "\n",
67
- "# Plot decision boundary\n",
68
- "def plot_decision_boundary(X, y, model):\n",
69
- " x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1\n",
70
- " y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1\n",
71
- " xx, yy = np.meshgrid(np.arange(x_min, x_max, 0.01), np.arange(y_min, y_max, 0.01))\n",
72
- " Z = model.predict(np.c_[xx.ravel(), yy.ravel()])\n",
73
- " Z = Z.reshape(xx.shape)\n",
74
- " plt.contourf(xx, yy, Z, alpha=0.8, cmap=plt.cm.coolwarm)\n",
75
- " plt.scatter(X[:, 0], X[:, 1], c=y, edgecolors='k', marker='o', cmap=plt.cm.coolwarm)\n",
76
- " plt.xlabel('PCA Component 1')\n",
77
- " plt.ylabel('PCA Component 2')\n",
78
- " plt.title('SVM Decision Boundary (2D)')\n",
79
- " plt.show()\n",
80
- "\n",
81
- "plot_decision_boundary(X_train_2d, y_train, svm_model)"
82
- ]
83
- }
84
- ],
85
- "metadata": {
86
- "colab": {
87
- "provenance": []
88
- },
89
- "kernelspec": {
90
- "display_name": "Python 3 (ipykernel)",
91
- "language": "python",
92
- "name": "python3"
93
- },
94
- "language_info": {
95
- "codemirror_mode": {
96
- "name": "ipython",
97
- "version": 3
98
- },
99
- "file_extension": ".py",
100
- "mimetype": "text/x-python",
101
- "name": "python",
102
- "nbconvert_exporter": "python",
103
- "pygments_lexer": "ipython3",
104
- "version": "3.12.4"
105
- }
106
- },
107
- "nbformat": 4,
108
- "nbformat_minor": 4
109
- }