noshot 0.3.8__py3-none-any.whl → 0.3.9__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.
- noshot/data/ML TS XAI/ML Additional/Bank.ipynb +74 -0
- noshot/data/ML TS XAI/ML Additional/LR.ipynb +69 -0
- noshot/data/ML TS XAI/ML Additional/ObesityDataSet_raw_and_data_sinthetic.csv +2112 -0
- noshot/data/ML TS XAI/ML Additional/Q4 LR.csv +206 -0
- noshot/data/ML TS XAI/ML Additional/Q7 BANK DETAILS.csv +41189 -0
- noshot/data/ML TS XAI/ML Additional/airfoil.ipynb +69 -0
- noshot/data/ML TS XAI/ML Additional/airfoil_self_noise.dat +1503 -0
- noshot/data/ML TS XAI/ML Additional/obesity.ipynb +78 -0
- noshot/data/ML TS XAI/ML Additional/voronoicode.ipynb +81 -0
- {noshot-0.3.8.dist-info → noshot-0.3.9.dist-info}/METADATA +1 -1
- {noshot-0.3.8.dist-info → noshot-0.3.9.dist-info}/RECORD +14 -5
- {noshot-0.3.8.dist-info → noshot-0.3.9.dist-info}/LICENSE.txt +0 -0
- {noshot-0.3.8.dist-info → noshot-0.3.9.dist-info}/WHEEL +0 -0
- {noshot-0.3.8.dist-info → noshot-0.3.9.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,78 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": null,
|
6
|
+
"id": "0654f3b1-de71-409d-b69e-bca199d6e851",
|
7
|
+
"metadata": {},
|
8
|
+
"outputs": [],
|
9
|
+
"source": [
|
10
|
+
"import pandas as pd\n",
|
11
|
+
"import numpy as np\n",
|
12
|
+
"from sklearn.model_selection import train_test_split\n",
|
13
|
+
"from sklearn.preprocessing import StandardScaler, LabelEncoder\n",
|
14
|
+
"from sklearn.neighbors import KNeighborsClassifier\n",
|
15
|
+
"from sklearn.decomposition import PCA\n",
|
16
|
+
"from sklearn.metrics import accuracy_score\n",
|
17
|
+
"\n",
|
18
|
+
"# Load the dataset\n",
|
19
|
+
"data = pd.read_csv('ObesityDataSet_raw_and_data_sinthetic.csv')\n",
|
20
|
+
"\n",
|
21
|
+
"# Encode categorical columns if any\n",
|
22
|
+
"for col in data.select_dtypes(include=['object']).columns:\n",
|
23
|
+
" data[col] = LabelEncoder().fit_transform(data[col])\n",
|
24
|
+
"\n",
|
25
|
+
"# Assuming the last column is the target variable\n",
|
26
|
+
"y = data.iloc[:, -1]\n",
|
27
|
+
"X = data.iloc[:, :-1]\n",
|
28
|
+
"\n",
|
29
|
+
"# Standardize the features\n",
|
30
|
+
"scaler = StandardScaler()\n",
|
31
|
+
"X_scaled = scaler.fit_transform(X)\n",
|
32
|
+
"\n",
|
33
|
+
"# Split into training and testing sets\n",
|
34
|
+
"X_train, X_test, y_train, y_test = train_test_split(X_scaled, y, test_size=0.2, random_state=42)\n",
|
35
|
+
"\n",
|
36
|
+
"# Apply KNN without PCA\n",
|
37
|
+
"knn = KNeighborsClassifier(n_neighbors=5)\n",
|
38
|
+
"knn.fit(X_train, y_train)\n",
|
39
|
+
"y_pred_knn = knn.predict(X_test)\n",
|
40
|
+
"knn_accuracy = accuracy_score(y_test, y_pred_knn)\n",
|
41
|
+
"print(f'KNN Accuracy without PCA: {knn_accuracy}')\n",
|
42
|
+
"\n",
|
43
|
+
"# Applying PCA (reducing to 2 principal components for visualization purposes)\n",
|
44
|
+
"pca = PCA(n_components=2)\n",
|
45
|
+
"X_train_pca = pca.fit_transform(X_train)\n",
|
46
|
+
"X_test_pca = pca.transform(X_test)\n",
|
47
|
+
"\n",
|
48
|
+
"# KNN with PCA-transformed data\n",
|
49
|
+
"knn_pca = KNeighborsClassifier(n_neighbors=5)\n",
|
50
|
+
"knn_pca.fit(X_train_pca, y_train)\n",
|
51
|
+
"y_pred_pca = knn_pca.predict(X_test_pca)\n",
|
52
|
+
"knn_pca_accuracy = accuracy_score(y_test, y_pred_pca)\n",
|
53
|
+
"print(f'KNN Accuracy with PCA: {knn_pca_accuracy}')\n"
|
54
|
+
]
|
55
|
+
}
|
56
|
+
],
|
57
|
+
"metadata": {
|
58
|
+
"kernelspec": {
|
59
|
+
"display_name": "Python 3 (ipykernel)",
|
60
|
+
"language": "python",
|
61
|
+
"name": "python3"
|
62
|
+
},
|
63
|
+
"language_info": {
|
64
|
+
"codemirror_mode": {
|
65
|
+
"name": "ipython",
|
66
|
+
"version": 3
|
67
|
+
},
|
68
|
+
"file_extension": ".py",
|
69
|
+
"mimetype": "text/x-python",
|
70
|
+
"name": "python",
|
71
|
+
"nbconvert_exporter": "python",
|
72
|
+
"pygments_lexer": "ipython3",
|
73
|
+
"version": "3.12.4"
|
74
|
+
}
|
75
|
+
},
|
76
|
+
"nbformat": 4,
|
77
|
+
"nbformat_minor": 5
|
78
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": null,
|
6
|
+
"id": "88e226f6-c463-4f5d-a469-a521debfb377",
|
7
|
+
"metadata": {},
|
8
|
+
"outputs": [],
|
9
|
+
"source": [
|
10
|
+
"import numpy as np\n",
|
11
|
+
"import matplotlib.pyplot as plt\n",
|
12
|
+
"from sklearn.neighbors import KNeighborsClassifier\n",
|
13
|
+
"from sklearn.datasets import make_classification\n",
|
14
|
+
"from scipy.spatial import Voronoi, voronoi_plot_2d\n",
|
15
|
+
"\n",
|
16
|
+
"# Generate synthetic dataset\n",
|
17
|
+
"X, y = make_classification(\n",
|
18
|
+
" n_samples=100,\n",
|
19
|
+
" n_features=2,\n",
|
20
|
+
" n_classes=3,\n",
|
21
|
+
" n_clusters_per_class=1,\n",
|
22
|
+
" n_redundant=0,\n",
|
23
|
+
" n_informative=2,\n",
|
24
|
+
" random_state=42,\n",
|
25
|
+
")\n",
|
26
|
+
"\n",
|
27
|
+
"# Fit KNN classifier\n",
|
28
|
+
"knn = KNeighborsClassifier(n_neighbors=3)\n",
|
29
|
+
"knn.fit(X, y)\n",
|
30
|
+
"\n",
|
31
|
+
"# Create a grid for decision boundary\n",
|
32
|
+
"x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1\n",
|
33
|
+
"y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1\n",
|
34
|
+
"xx, yy = np.meshgrid(np.linspace(x_min, x_max, 500), np.linspace(y_min, y_max, 500))\n",
|
35
|
+
"grid_points = np.c_[xx.ravel(), yy.ravel()]\n",
|
36
|
+
"\n",
|
37
|
+
"# Predict on the grid\n",
|
38
|
+
"Z = knn.predict(grid_points)\n",
|
39
|
+
"Z = Z.reshape(xx.shape)\n",
|
40
|
+
"\n",
|
41
|
+
"# Plot decision boundaries\n",
|
42
|
+
"plt.figure(figsize=(10, 7))\n",
|
43
|
+
"plt.contourf(xx, yy, Z, alpha=0.3, cmap=plt.cm.Paired)\n",
|
44
|
+
"plt.scatter(X[:, 0], X[:, 1], c=y, edgecolor='k', cmap=plt.cm.Paired, label='Data Points')\n",
|
45
|
+
"\n",
|
46
|
+
"# Compute Voronoi regions\n",
|
47
|
+
"vor = Voronoi(X)\n",
|
48
|
+
"voronoi_plot_2d(vor, ax=plt.gca(), show_points=False, show_vertices=False, line_colors='black', line_width=0.8)\n",
|
49
|
+
"\n",
|
50
|
+
"# Display plot\n",
|
51
|
+
"plt.title(\"KNN Classification with Voronoi Diagram (k=3)\")\n",
|
52
|
+
"plt.xlabel(\"Feature 1\")\n",
|
53
|
+
"plt.ylabel(\"Feature 2\")\n",
|
54
|
+
"plt.legend(loc=\"upper right\")\n",
|
55
|
+
"plt.grid()\n",
|
56
|
+
"plt.show()"
|
57
|
+
]
|
58
|
+
}
|
59
|
+
],
|
60
|
+
"metadata": {
|
61
|
+
"kernelspec": {
|
62
|
+
"display_name": "Python 3 (ipykernel)",
|
63
|
+
"language": "python",
|
64
|
+
"name": "python3"
|
65
|
+
},
|
66
|
+
"language_info": {
|
67
|
+
"codemirror_mode": {
|
68
|
+
"name": "ipython",
|
69
|
+
"version": 3
|
70
|
+
},
|
71
|
+
"file_extension": ".py",
|
72
|
+
"mimetype": "text/x-python",
|
73
|
+
"name": "python",
|
74
|
+
"nbconvert_exporter": "python",
|
75
|
+
"pygments_lexer": "ipython3",
|
76
|
+
"version": "3.12.4"
|
77
|
+
}
|
78
|
+
},
|
79
|
+
"nbformat": 4,
|
80
|
+
"nbformat_minor": 5
|
81
|
+
}
|
@@ -10,6 +10,15 @@ noshot/data/ML TS XAI/ML/data/balance-scale.csv,sha256=TIXuC522eeShSGKEzpVdslBH-
|
|
10
10
|
noshot/data/ML TS XAI/ML/data/balance-scale.txt,sha256=_QWQ4ru9MWCeh_4x372ev6Ipg5oOeUcGFH_2Jp0QA9E,6249
|
11
11
|
noshot/data/ML TS XAI/ML/data/machine-data.csv,sha256=poHH1NKX94SE7hyRTX7Gug4fWdAHRY4SnUNwYg_B1TQ,8746
|
12
12
|
noshot/data/ML TS XAI/ML/data/wine-dataset.csv,sha256=zYAVj609HiA9YdrkIkJiCwLdX5GOY3tfCDgeOefPUgQ,12261
|
13
|
+
noshot/data/ML TS XAI/ML Additional/Bank.ipynb,sha256=PX9-mjUbYAtRNgXPg-t3nzeq3Hat3Fm3LZxpAgy-yek,2332
|
14
|
+
noshot/data/ML TS XAI/ML Additional/LR.ipynb,sha256=d1t6_xphPFCAMikhaAZK2f63rSIEJVH3NQpPshHw--E,2050
|
15
|
+
noshot/data/ML TS XAI/ML Additional/ObesityDataSet_raw_and_data_sinthetic.csv,sha256=ti4escjJgTeb7iPjnjVoP1RVaDvXctxyKCcVjd6Smh8,261534
|
16
|
+
noshot/data/ML TS XAI/ML Additional/Q4 LR.csv,sha256=LRgNqCbNasyiVsTnl76sCq5bSzf7t3SvwbkK6DGcW2U,26511
|
17
|
+
noshot/data/ML TS XAI/ML Additional/Q7 BANK DETAILS.csv,sha256=u0Wt2R1OAocPzeKO5PkTt4JopapgUej74sPhYBBAQ1U,4887557
|
18
|
+
noshot/data/ML TS XAI/ML Additional/airfoil.ipynb,sha256=P7xJDaG0gr7y6RoaCzW-2izjgetesGXPtFcRts1Hkes,2115
|
19
|
+
noshot/data/ML TS XAI/ML Additional/airfoil_self_noise.dat,sha256=EO4G5s-yfa5rRCE9Qh0hcBL7H5tpdZLnOk5AFrUtQl8,58481
|
20
|
+
noshot/data/ML TS XAI/ML Additional/obesity.ipynb,sha256=-I7RSTLvsap3l02NpQwPJKzGsIy-rpvDPSbUBpjrOpc,2528
|
21
|
+
noshot/data/ML TS XAI/ML Additional/voronoicode.ipynb,sha256=dxkLk_SCxksdYu-RiEZdzsLjfgTDqvSb464IjxiDl5w,2413
|
13
22
|
noshot/data/ML TS XAI/ML Lab CIA/1/1.ipynb,sha256=RwpYKNBXvwkAuT8f5mvs56Qg8oml847e1Lz4Rn3B9Co,3995
|
14
23
|
noshot/data/ML TS XAI/ML Lab CIA/1/Question.txt,sha256=cxrnnGmeKfFzUdYcD2H1iNBqBArJwuvkxBryrx45pcg,389
|
15
24
|
noshot/data/ML TS XAI/ML Lab CIA/1/airfoil_self_noise.dat,sha256=EO4G5s-yfa5rRCE9Qh0hcBL7H5tpdZLnOk5AFrUtQl8,58481
|
@@ -46,8 +55,8 @@ noshot/data/ML TS XAI/TS Lab CIA/5 - shampoo sales/5 - Shampoo sales.ipynb,sha2
|
|
46
55
|
noshot/data/ML TS XAI/TS Lab CIA/5 - shampoo sales/shampoo_sales.csv,sha256=c3ry-Yy1m-MoLGWopaD9jfVX9UZ2JRBBJA2DtwWi_fg,484
|
47
56
|
noshot/utils/__init__.py,sha256=NovRMat6RWu1WNI1_OH_Xo6Uvaq8D91no-ZhLcuVwHs,108
|
48
57
|
noshot/utils/shell_utils.py,sha256=WzVq5EZEgiJFysbDYn9QPRYSE555Ew20HZbb3RDymkE,2555
|
49
|
-
noshot-0.3.
|
50
|
-
noshot-0.3.
|
51
|
-
noshot-0.3.
|
52
|
-
noshot-0.3.
|
53
|
-
noshot-0.3.
|
58
|
+
noshot-0.3.9.dist-info/LICENSE.txt,sha256=MLVZLpViyRWQLkQCesNwRqdfGzt-aunQSFiP5b_5Qn4,1066
|
59
|
+
noshot-0.3.9.dist-info/METADATA,sha256=0K34AYcusoZVHqiPDJLaDFqzwG6jHHxiClrcFy2r3zM,2391
|
60
|
+
noshot-0.3.9.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
61
|
+
noshot-0.3.9.dist-info/top_level.txt,sha256=UL-c0HffdRwohz-y9icY_rnY48pQDdxGcBsgyCKh2Q8,7
|
62
|
+
noshot-0.3.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|