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
@@ -0,0 +1,115 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "2d42ca1a-531d-4d5b-aee4-a489d5033d1b",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import matplotlib.pyplot as plt\n",
12
+ "from sklearn.model_selection import train_test_split\n",
13
+ "from sklearn.linear_model import LinearRegression\n",
14
+ "from sklearn.metrics import r2_score"
15
+ ]
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": null,
20
+ "id": "f81220bc-5415-4b02-b2fd-fd5a8ff8c97a",
21
+ "metadata": {},
22
+ "outputs": [],
23
+ "source": [
24
+ "df = pd.read_csv('data/machine-data.csv')\n",
25
+ "print(\"Shape:\", df.shape)\n",
26
+ "df.head()"
27
+ ]
28
+ },
29
+ {
30
+ "cell_type": "code",
31
+ "execution_count": null,
32
+ "id": "958f3a04-3ae7-442b-a6e7-9134b9c5aeb3",
33
+ "metadata": {},
34
+ "outputs": [],
35
+ "source": [
36
+ "x = df.iloc[:,3:4].values\n",
37
+ "y = df.iloc[:,8].values\n",
38
+ "\n",
39
+ "X_train, X_test, y_train, y_test = train_test_split(x, y, test_size = 0.2, random_state = 0)\n",
40
+ "regressor = LinearRegression()\n",
41
+ "regressor.fit(X_train, y_train)"
42
+ ]
43
+ },
44
+ {
45
+ "cell_type": "code",
46
+ "execution_count": null,
47
+ "id": "5b15fa5c-5c78-436b-8f33-4f431c797788",
48
+ "metadata": {},
49
+ "outputs": [],
50
+ "source": [
51
+ "y_pred = regressor.predict(X_test)\n",
52
+ "y_pred_train = regressor.predict(X_train)\n",
53
+ "print(\"Model Score: \", regressor.score(X_test, y_test))\n",
54
+ "print(\"R2 Score: \", r2_score(y_test, y_pred))"
55
+ ]
56
+ },
57
+ {
58
+ "cell_type": "code",
59
+ "execution_count": null,
60
+ "id": "b044ea95-014e-466b-b036-8ba9f96e3910",
61
+ "metadata": {},
62
+ "outputs": [],
63
+ "source": [
64
+ "plt.scatter(X_train, y_train, color = 'red')\n",
65
+ "plt.plot(X_train, regressor.predict(X_train), color = 'blue')\n",
66
+ "plt.title('Y vs X (Training set)')\n",
67
+ "plt.xlabel('X')\n",
68
+ "plt.ylabel('Y')\n",
69
+ "plt.show()\n",
70
+ "plt.scatter(X_test, y_test, color = 'red')\n",
71
+ "plt.plot(X_train, regressor.predict(X_train), color = 'blue')\n",
72
+ "plt.title('Y vs X (Test set)')\n",
73
+ "plt.xlabel('X')"
74
+ ]
75
+ },
76
+ {
77
+ "cell_type": "code",
78
+ "execution_count": null,
79
+ "id": "33c64414-d432-439e-a976-d28a9b4c3f2a",
80
+ "metadata": {},
81
+ "outputs": [],
82
+ "source": [
83
+ "X_future_expereince = [[2],[4]]\n",
84
+ "print(\"Prediction :\", regressor.predict(X_future_expereince))\n",
85
+ "plt.scatter(X_future_expereince, regressor.predict(X_future_expereince), color = 'red')\n",
86
+ "plt.plot(X_train, regressor.predict(X_train), color = 'blue')\n",
87
+ "plt.title('Y vs X (Test set)')\n",
88
+ "plt.xlabel('X')\n",
89
+ "plt.ylabel('Y')\n",
90
+ "plt.show()"
91
+ ]
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
+ }
@@ -0,0 +1,159 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "4e998aac",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import numpy as np\n",
11
+ "import pandas as pd\n",
12
+ "import seaborn as sns\n",
13
+ "import matplotlib.pyplot as plt\n",
14
+ "from sklearn.model_selection import train_test_split"
15
+ ]
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": null,
20
+ "id": "7fef393a",
21
+ "metadata": {},
22
+ "outputs": [],
23
+ "source": [
24
+ "df=pd.read_excel(\"data/real-estate.xlsx\")\n",
25
+ "print(\"Shape:\", df.shape)\n",
26
+ "df.head()"
27
+ ]
28
+ },
29
+ {
30
+ "cell_type": "code",
31
+ "execution_count": null,
32
+ "id": "18f866b3",
33
+ "metadata": {},
34
+ "outputs": [],
35
+ "source": [
36
+ "df.isnull().sum()"
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": null,
42
+ "id": "c238436e",
43
+ "metadata": {},
44
+ "outputs": [],
45
+ "source": [
46
+ "sns.pairplot(df)"
47
+ ]
48
+ },
49
+ {
50
+ "cell_type": "code",
51
+ "execution_count": null,
52
+ "id": "480aa3b6",
53
+ "metadata": {},
54
+ "outputs": [],
55
+ "source": [
56
+ "corr = df.corr()\n",
57
+ "sns.heatmap(corr)"
58
+ ]
59
+ },
60
+ {
61
+ "cell_type": "code",
62
+ "execution_count": null,
63
+ "id": "7fe55d8d",
64
+ "metadata": {},
65
+ "outputs": [],
66
+ "source": [
67
+ "def lin_reg(colX):\n",
68
+ " X = df[colX].values\n",
69
+ " y = df['Y house price of unit area'].values\n",
70
+ "\n",
71
+ " X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
72
+ "\n",
73
+ " N = len(X_train)\n",
74
+ " sum_x = np.sum(X_train)\n",
75
+ " sum_y = np.sum(y_train)\n",
76
+ " sum_xy = np.sum(X_train * y_train)\n",
77
+ " sum_x2 = np.sum(X_train ** 2)\n",
78
+ "\n",
79
+ " beta1 = (N * sum_xy - sum_x * sum_y) / (N * sum_x2 - sum_x ** 2)\n",
80
+ " beta0 = (sum_y - beta1 * sum_x) / N\n",
81
+ "\n",
82
+ " y_pred_train = beta1 * X_train + beta0\n",
83
+ " y_pred_test = beta1 * X_test + beta0\n",
84
+ "\n",
85
+ " plt.scatter(X_train, y_train, color='blue', label='Training Data Points')\n",
86
+ " plt.plot(X_train, y_pred_train, color='red', label='Regression Line (Training)')\n",
87
+ " plt.xlabel(colX)\n",
88
+ " plt.ylabel('Y house price of unit area')\n",
89
+ " plt.title(f'Linear Regression: {colX} vs Y (Training Set)')\n",
90
+ " plt.legend()\n",
91
+ " plt.show()\n",
92
+ "\n",
93
+ " plt.scatter(X_test, y_test, color='blue', label='Test Data Points')\n",
94
+ " plt.plot(X_test, y_pred_test, color='red', label='Regression Line (Test)')\n",
95
+ " plt.xlabel(colX)\n",
96
+ " plt.ylabel('Y house price of unit area')\n",
97
+ " plt.title(f'Linear Regression: {colX} vs Y (Test Set)')\n",
98
+ " plt.legend()\n",
99
+ " plt.show()\n",
100
+ "\n",
101
+ " mse_train = np.mean((y_train - y_pred_train) ** 2)\n",
102
+ " mse_test = np.mean((y_test - y_pred_test) ** 2)\n",
103
+ " print(f\"Mean Squared Error (MSE) for Training Set: {mse_train}\")\n",
104
+ " print(f\"Mean Squared Error (MSE) for Test Set: {mse_test}\")"
105
+ ]
106
+ },
107
+ {
108
+ "cell_type": "code",
109
+ "execution_count": null,
110
+ "id": "8d80579a",
111
+ "metadata": {},
112
+ "outputs": [],
113
+ "source": [
114
+ "lin_reg('X3 distance to the nearest MRT station')"
115
+ ]
116
+ },
117
+ {
118
+ "cell_type": "code",
119
+ "execution_count": null,
120
+ "id": "6b162be8",
121
+ "metadata": {},
122
+ "outputs": [],
123
+ "source": [
124
+ "lin_reg('X5 latitude')"
125
+ ]
126
+ },
127
+ {
128
+ "cell_type": "code",
129
+ "execution_count": null,
130
+ "id": "7b576d0a",
131
+ "metadata": {},
132
+ "outputs": [],
133
+ "source": [
134
+ "lin_reg('X6 longitude')"
135
+ ]
136
+ }
137
+ ],
138
+ "metadata": {
139
+ "kernelspec": {
140
+ "display_name": "Python 3 (ipykernel)",
141
+ "language": "python",
142
+ "name": "python3"
143
+ },
144
+ "language_info": {
145
+ "codemirror_mode": {
146
+ "name": "ipython",
147
+ "version": 3
148
+ },
149
+ "file_extension": ".py",
150
+ "mimetype": "text/x-python",
151
+ "name": "python",
152
+ "nbconvert_exporter": "python",
153
+ "pygments_lexer": "ipython3",
154
+ "version": "3.12.4"
155
+ }
156
+ },
157
+ "nbformat": 4,
158
+ "nbformat_minor": 5
159
+ }
@@ -3,198 +3,177 @@
3
3
  {
4
4
  "cell_type": "code",
5
5
  "execution_count": null,
6
- "id": "ccf7df96",
6
+ "id": "5bafc01f",
7
7
  "metadata": {},
8
8
  "outputs": [],
9
9
  "source": [
10
- "import pandas as pd \n",
11
- "import numpy as np\n",
10
+ "import pandas as pd\n",
12
11
  "import matplotlib.pyplot as plt\n",
13
- "import seaborn as sns"
12
+ "import seaborn as sns\n",
13
+ "from sklearn.model_selection import train_test_split\n",
14
+ "from sklearn.linear_model import LogisticRegression\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 MinMaxScaler\n",
18
+ "from sklearn.decomposition import PCA"
14
19
  ]
15
20
  },
16
21
  {
17
22
  "cell_type": "code",
18
23
  "execution_count": null,
19
- "id": "05fcafeb",
24
+ "id": "6ef7990c",
20
25
  "metadata": {},
21
26
  "outputs": [],
22
27
  "source": [
23
- "auto=pd.read_csv(\"loan_data.csv\")\n",
24
- "auto.reset_index(inplace=True)\n",
25
- "auto"
28
+ "df = pd.read_csv('data/magic04.data', header=None)\n",
29
+ "df.head()"
26
30
  ]
27
31
  },
28
32
  {
29
33
  "cell_type": "code",
30
34
  "execution_count": null,
31
- "id": "774d8ecf",
35
+ "id": "1f1065b5",
32
36
  "metadata": {},
33
37
  "outputs": [],
34
38
  "source": [
35
- "auto.head()"
39
+ "df[10] = df[10].map({'g':0,'h':1})"
36
40
  ]
37
41
  },
38
42
  {
39
43
  "cell_type": "code",
40
44
  "execution_count": null,
41
- "id": "66bef117",
45
+ "id": "5f228790",
42
46
  "metadata": {},
43
47
  "outputs": [],
44
48
  "source": [
45
- "auto.tail()"
49
+ "sns.pairplot(df, hue=10)"
46
50
  ]
47
51
  },
48
52
  {
49
53
  "cell_type": "code",
50
54
  "execution_count": null,
51
- "id": "d12303ac",
55
+ "id": "a5e91b36",
52
56
  "metadata": {},
53
57
  "outputs": [],
54
58
  "source": [
55
- "auto.info()"
59
+ "X = df.drop(columns=[10])\n",
60
+ "X"
56
61
  ]
57
62
  },
58
63
  {
59
64
  "cell_type": "code",
60
65
  "execution_count": null,
61
- "id": "13ca9a52",
66
+ "id": "dcbc168e",
62
67
  "metadata": {},
63
68
  "outputs": [],
64
69
  "source": [
65
- "auto.nunique()"
70
+ "X = MinMaxScaler().fit_transform(X)\n",
71
+ "X"
66
72
  ]
67
73
  },
68
74
  {
69
75
  "cell_type": "code",
70
76
  "execution_count": null,
71
- "id": "406b67f4",
77
+ "id": "a4a1e805",
72
78
  "metadata": {},
73
79
  "outputs": [],
74
80
  "source": [
75
- "auto.isnull()"
81
+ "y = df[10]\n",
82
+ "y"
76
83
  ]
77
84
  },
78
85
  {
79
86
  "cell_type": "code",
80
87
  "execution_count": null,
81
- "id": "eaa5f031",
88
+ "id": "7edc3c7f",
82
89
  "metadata": {},
83
90
  "outputs": [],
84
91
  "source": [
85
- "auto.describe()"
92
+ "y.value_counts()"
86
93
  ]
87
94
  },
88
95
  {
89
96
  "cell_type": "code",
90
97
  "execution_count": null,
91
- "id": "214537c9",
98
+ "id": "243c084d",
92
99
  "metadata": {},
93
100
  "outputs": [],
94
101
  "source": [
95
- "data = auto.drop(['index'], axis = 1)\n",
96
- "data"
102
+ "lr = LogisticRegression(max_iter=10000, random_state=0)"
97
103
  ]
98
104
  },
99
105
  {
100
106
  "cell_type": "code",
101
107
  "execution_count": null,
102
- "id": "9e22f6d6",
108
+ "id": "92615b1f",
103
109
  "metadata": {},
104
110
  "outputs": [],
105
111
  "source": [
106
- "print(auto.purpose.unique())"
112
+ "X_train, X_test, y_train, y_test=train_test_split(X, y, test_size=0.2, random_state=42, stratify=y)"
107
113
  ]
108
114
  },
109
115
  {
110
116
  "cell_type": "code",
111
117
  "execution_count": null,
112
- "id": "95a9706b",
118
+ "id": "114a44f5",
113
119
  "metadata": {},
114
120
  "outputs": [],
115
121
  "source": [
116
- "print(auto.purpose.nunique())"
122
+ "lr.fit(X_train,y_train)"
117
123
  ]
118
124
  },
119
125
  {
120
126
  "cell_type": "code",
121
127
  "execution_count": null,
122
- "id": "0c895e16",
128
+ "id": "79e3ed49",
123
129
  "metadata": {},
124
130
  "outputs": [],
125
131
  "source": [
126
- "au=auto.head(50)\n",
127
- "au"
132
+ "y_pred = lr.predict(X_test)\n",
133
+ "print(f\"Accuracy : {accuracy_score(y_test,y_pred)}\")"
128
134
  ]
129
135
  },
130
136
  {
131
137
  "cell_type": "code",
132
138
  "execution_count": null,
133
- "id": "ff300c7a",
139
+ "id": "f377d0cc",
134
140
  "metadata": {},
135
141
  "outputs": [],
136
142
  "source": [
137
- "plt.title(\"INSTALLMENT BASED ON ANNUAL INCOME\")\n",
138
- "plt.xlabel(\"log.annual.inc\")\n",
139
- "plt.ylabel(\"installment\")\n",
140
- "plt.plot(au['log.annual.inc'],au['installment'],color=\"blue\")\n",
141
- "plt.show(10,20)"
143
+ "report = classification_report(y_test,y_pred)\n",
144
+ "print(report)"
142
145
  ]
143
146
  },
144
147
  {
145
148
  "cell_type": "code",
146
149
  "execution_count": null,
147
- "id": "f53a7f1d",
150
+ "id": "e42690dc",
148
151
  "metadata": {},
149
152
  "outputs": [],
150
153
  "source": [
151
- "plt.title(\"INSTALLMENT BASED ON ANNUAL INCOME\")\n",
152
- "plt.xlabel(\"log.annual.inc\")\n",
153
- "plt.ylabel(\"installment\")\n",
154
- "plt.bar(au['log.annual.inc'],au['installment'],color=\"green\")\n",
155
- "plt.show()\n"
154
+ "cm = confusion_matrix(y_test,y_pred)\n",
155
+ "ConfusionMatrixDisplay(cm).plot()"
156
156
  ]
157
157
  },
158
158
  {
159
159
  "cell_type": "code",
160
160
  "execution_count": null,
161
- "id": "f0625d78",
161
+ "id": "bd35e7f4",
162
162
  "metadata": {},
163
163
  "outputs": [],
164
164
  "source": [
165
- "sns.pairplot(au)"
166
- ]
167
- },
168
- {
169
- "cell_type": "code",
170
- "execution_count": null,
171
- "id": "88d11bbd",
172
- "metadata": {},
173
- "outputs": [],
174
- "source": [
175
- "plt.hist(au['installment'],bins=10,color='cyan')\n",
165
+ "y_pred_proba = lr.predict_proba(X_test)[:,1]\n",
166
+ "fpr, tpr, thresholds = roc_curve(y_test, y_pred_proba) \n",
167
+ "roc_auc = auc(fpr, tpr)\n",
168
+ "\n",
169
+ "plt.plot(fpr, tpr, label='ROC curve (area = %0.2f)' % roc_auc)\n",
170
+ "plt.plot([0, 1], [0, 1], 'k--', label='No Skill')\n",
171
+ "plt.xlabel('False Positive Rate')\n",
172
+ "plt.ylabel('True Positive Rate')\n",
173
+ "plt.title('ROC Curve for Breast Cancer Classification')\n",
174
+ "plt.legend()\n",
176
175
  "plt.show()"
177
176
  ]
178
- },
179
- {
180
- "cell_type": "code",
181
- "execution_count": null,
182
- "id": "bfc6edb5",
183
- "metadata": {},
184
- "outputs": [],
185
- "source": [
186
- "plt.figure(figsize=(12, 7))\n",
187
- "sns.heatmap(au.corr(), annot = True, vmin = -1, vmax = 1)\n",
188
- "plt.show()"
189
- ]
190
- },
191
- {
192
- "cell_type": "code",
193
- "execution_count": null,
194
- "id": "adc44fdc-323a-4b9f-9ec2-1227ef925241",
195
- "metadata": {},
196
- "outputs": [],
197
- "source": []
198
177
  }
199
178
  ],
200
179
  "metadata": {
@@ -0,0 +1,112 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "0fcc8bb7-4d22-4d3b-b58a-302bb24f8f2e",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import itertools\n",
11
+ "import numpy as np\n",
12
+ "import pandas as pd\n",
13
+ "import matplotlib.pyplot as plt\n",
14
+ "from sklearn import linear_model,datasets\n",
15
+ "from sklearn.model_selection import train_test_split\n",
16
+ "from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay\n",
17
+ "\n",
18
+ "import warnings\n",
19
+ "warnings.filterwarnings('ignore')"
20
+ ]
21
+ },
22
+ {
23
+ "cell_type": "code",
24
+ "execution_count": null,
25
+ "id": "d28e507b-fb15-4058-a161-656859a27c65",
26
+ "metadata": {},
27
+ "outputs": [],
28
+ "source": [
29
+ "wine = pd.read_csv('data/wine-dataset.csv')\n",
30
+ "print(\"Shape:\", wine.shape)\n",
31
+ "wine.head()"
32
+ ]
33
+ },
34
+ {
35
+ "cell_type": "code",
36
+ "execution_count": null,
37
+ "id": "c4e953da-6941-43f2-a9ce-aab907876d45",
38
+ "metadata": {},
39
+ "outputs": [],
40
+ "source": [
41
+ "wine.columns"
42
+ ]
43
+ },
44
+ {
45
+ "cell_type": "code",
46
+ "execution_count": null,
47
+ "id": "9ee44a66-dc4a-4c79-9dab-eec60669dd8b",
48
+ "metadata": {},
49
+ "outputs": [],
50
+ "source": [
51
+ "X = wine.iloc[:, :13]\n",
52
+ "y = wine.iloc[:, 13]"
53
+ ]
54
+ },
55
+ {
56
+ "cell_type": "code",
57
+ "execution_count": null,
58
+ "id": "bd9d60dd-8272-46b4-8335-69d9751ed0c7",
59
+ "metadata": {},
60
+ "outputs": [],
61
+ "source": [
62
+ "X_train,X_test,y_train,y_test = train_test_split(X, y, test_size=0.30, random_state=7)\n",
63
+ "\n",
64
+ "log_reg_model = linear_model.LogisticRegression()\n",
65
+ "log_reg_model.fit(X_train,y_train)"
66
+ ]
67
+ },
68
+ {
69
+ "cell_type": "code",
70
+ "execution_count": null,
71
+ "id": "7c8fca42-c8d8-4334-9cc4-da4f5e1b0a1e",
72
+ "metadata": {},
73
+ "outputs": [],
74
+ "source": [
75
+ "log_reg_base_score = log_reg_model.score(X_test,y_test)\n",
76
+ "print(\"The score for the Logistic Regression Model is : \", log_reg_base_score)"
77
+ ]
78
+ },
79
+ {
80
+ "cell_type": "code",
81
+ "execution_count": null,
82
+ "id": "61bbb23e-cb29-41ae-9ea3-82e8d465c7f2",
83
+ "metadata": {},
84
+ "outputs": [],
85
+ "source": [
86
+ "cm = confusion_matrix(y_test, log_reg_model.predict(X_test))\n",
87
+ "ConfusionMatrixDisplay(cm).plot()"
88
+ ]
89
+ }
90
+ ],
91
+ "metadata": {
92
+ "kernelspec": {
93
+ "display_name": "Python 3 (ipykernel)",
94
+ "language": "python",
95
+ "name": "python3"
96
+ },
97
+ "language_info": {
98
+ "codemirror_mode": {
99
+ "name": "ipython",
100
+ "version": 3
101
+ },
102
+ "file_extension": ".py",
103
+ "mimetype": "text/x-python",
104
+ "name": "python",
105
+ "nbconvert_exporter": "python",
106
+ "pygments_lexer": "ipython3",
107
+ "version": "3.12.4"
108
+ }
109
+ },
110
+ "nbformat": 4,
111
+ "nbformat_minor": 5
112
+ }