noshot 0.2.4__py3-none-any.whl → 0.2.6__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 (36) hide show
  1. noshot/main.py +18 -18
  2. noshot/utils/__init__.py +2 -2
  3. noshot/utils/shell_utils.py +56 -56
  4. {noshot-0.2.4.dist-info → noshot-0.2.6.dist-info}/LICENSE.txt +20 -20
  5. {noshot-0.2.4.dist-info → noshot-0.2.6.dist-info}/METADATA +55 -55
  6. noshot-0.2.6.dist-info/RECORD +9 -0
  7. noshot/data/ML TS XAI/ML/1. PCA - EDA/PCA-EDA.ipynb +0 -207
  8. noshot/data/ML TS XAI/ML/1. PCA - EDA/balance-scale.csv +0 -626
  9. noshot/data/ML TS XAI/ML/1. PCA - EDA/input.txt +0 -625
  10. noshot/data/ML TS XAI/ML/2. KNN Classifier/KNN.ipynb +0 -287
  11. noshot/data/ML TS XAI/ML/2. KNN Classifier/balance-scale.csv +0 -626
  12. noshot/data/ML TS XAI/ML/2. KNN Classifier/input.txt +0 -625
  13. noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/LDA.ipynb +0 -83
  14. noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/balance-scale.csv +0 -626
  15. noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/input.txt +0 -625
  16. noshot/data/ML TS XAI/ML/4. Linear Regression/Linear-Regression.ipynb +0 -117
  17. noshot/data/ML TS XAI/ML/4. Linear Regression/machine-data.csv +0 -210
  18. noshot/data/ML TS XAI/ML/5. Logistic Regression/Logistic-Regression.ipynb +0 -137
  19. noshot/data/ML TS XAI/ML/5. Logistic Regression/wine-dataset.csv +0 -179
  20. noshot/data/ML TS XAI/ML/6. Bayesian Classifier/Bayesian.ipynb +0 -87
  21. noshot/data/ML TS XAI/ML/6. Bayesian Classifier/wine-dataset.csv +0 -179
  22. noshot/data/ML TS XAI/TS/1. EDA - Handling Time Series Data/Handling TS Data.ipynb +0 -247
  23. noshot/data/ML TS XAI/TS/1. EDA - Handling Time Series Data/raw_sales.csv +0 -29581
  24. noshot/data/ML TS XAI/TS/2. Feature Engineering/Feature Engineering-.ipynb +0 -183
  25. noshot/data/ML TS XAI/TS/3. Temporal Relationships/Exploring Temporal Relationships.ipynb +0 -172
  26. noshot/data/ML TS XAI/TS/4. Up-Down-Sampling and Interploation/Up-Down-Sampling.ipynb +0 -146
  27. noshot/data/ML TS XAI/TS/4. Up-Down-Sampling and Interploation/shampoo_sales.csv +0 -37
  28. noshot/data/ML TS XAI/TS/5. Stationarity - Trend - Seasonality/Stationarity-Trend-Seasonality.ipynb +0 -173
  29. noshot/data/ML TS XAI/TS/5. Stationarity - Trend - Seasonality/daily-min-temperatures.csv +0 -3651
  30. noshot/data/ML TS XAI/TS/5. Stationarity - Trend - Seasonality/daily-total-female-births.csv +0 -366
  31. noshot/data/ML TS XAI/TS/6. Autocorrelation - Partial Autocorrelation/ACF-PACF.ipynb +0 -77
  32. noshot/data/ML TS XAI/TS/6. Autocorrelation - Partial Autocorrelation/daily-min-temperatures.csv +0 -3651
  33. noshot/data/ML TS XAI/TS/AllinOne.ipynb +0 -12676
  34. noshot-0.2.4.dist-info/RECORD +0 -36
  35. {noshot-0.2.4.dist-info → noshot-0.2.6.dist-info}/WHEEL +0 -0
  36. {noshot-0.2.4.dist-info → noshot-0.2.6.dist-info}/top_level.txt +0 -0
noshot/main.py CHANGED
@@ -1,19 +1,19 @@
1
- from noshot.utils.shell_utils import get_folder
2
- from noshot.utils.shell_utils import get_file
3
- from noshot.utils.shell_utils import remove_folder
4
-
5
- available = {'-1 ' : "ML TS XAI(Folder)",
6
- '0 ' : "Remove Folder"}
7
-
8
- def get(name = None, open = False):
9
- try:
10
- if name is not None:
11
- name = str(name)
12
- if name in ['-1'] : get_folder("ML TS XAI", loc = True)
13
- elif name in ['0'] : remove_folder("ML TS XAI")
14
- else:
15
- for k, v in available.items():
16
- sep = " : " if v else ""
17
- print(k,v,sep = sep)
18
- except Exception as error:
1
+ from noshot.utils.shell_utils import get_folder
2
+ from noshot.utils.shell_utils import get_file
3
+ from noshot.utils.shell_utils import remove_folder
4
+
5
+ available = {'-1 ' : "ML TS XAI(Folder)",
6
+ '0 ' : "Remove Folder"}
7
+
8
+ def get(name = None, open = False):
9
+ try:
10
+ if name is not None:
11
+ name = str(name)
12
+ if name in ['-1'] : get_folder("ML TS XAI", loc = True)
13
+ elif name in ['0'] : remove_folder("ML TS XAI")
14
+ else:
15
+ for k, v in available.items():
16
+ sep = " : " if v else ""
17
+ print(k,v,sep = sep)
18
+ except Exception as error:
19
19
  print(error)
noshot/utils/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
- from .shell_utils import get_file
2
- from .shell_utils import get_folder
1
+ from .shell_utils import get_file
2
+ from .shell_utils import get_folder
3
3
  from .shell_utils import remove_folder
@@ -1,57 +1,57 @@
1
- import os
2
- import shutil
3
- import subprocess
4
- import pathlib
5
-
6
- def get_folder(folder_path, loc = False):
7
- src = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data", pathlib.Path(folder_path))
8
- try:
9
- dest = os.path.join(os.getcwd(), pathlib.Path(folder_path))
10
- shutil.copytree(src, dest, symlinks=False, copy_function = shutil.copy2,
11
- ignore=shutil.ignore_patterns('.ipynb_checkpoints', '__init__.py', '__pycache__'),
12
- ignore_dangling_symlinks=False, dirs_exist_ok=True)
13
- except:
14
- try:
15
- dest = os.path.join(os.path.expanduser('~'), "Downloads", pathlib.Path(folder_path))
16
- shutil.copytree(src, dest, symlinks=False, copy_function = shutil.copy2,
17
- ignore=shutil.ignore_patterns('.ipynb_checkpoints', '__init__.py', '__pycache__'),
18
- ignore_dangling_symlinks=False, dirs_exist_ok=True)
19
- except Exception as error:
20
- print(error)
21
- return
22
- finally:
23
- if loc:
24
- print("Path:",dest)
25
-
26
- def get_file(file_path, loc = False, open = False):
27
- src = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data", pathlib.Path(file_path))
28
- try:
29
- dest = os.path.join(os.getcwd(), pathlib.Path(file_path).name)
30
- shutil.copy(src, dest)
31
- if open:
32
- subprocess.Popen(f"jupyter notebook {dest}")
33
- except:
34
- try:
35
- dest = os.path.join(os.path.expanduser('~'), "Downloads", pathlib.Path(file_path).name)
36
- shutil.copy(src, dest)
37
- except Exception as error:
38
- print(error)
39
- finally:
40
- if loc:
41
- print("Path:",dest)
42
-
43
- def remove_folder(folder_path):
44
- try:
45
- src1 = os.path.join(os.getcwd(), pathlib.Path(folder_path))
46
- src2 = os.path.join(os.path.expanduser('~'), "Downloads", pathlib.Path(folder_path))
47
- if os.path.exists(src1) or os.path.exists(src2):
48
- shutil.rmtree(src1, ignore_errors = True)
49
- shutil.rmtree(src2, ignore_errors = True)
50
- if os.path.exists(src1) or os.path.exists(src2):
51
- print("Deletion Impossible [File Not Closed - Shutdown File Kernel]\nGo to Home page -> Running Tab -> Click Shut Down All")
52
- else:
53
- print(f"Folder({pathlib.Path(folder_path)}) Removed Successfully")
54
- else:
55
- print(f"Folder({pathlib.Path(folder_path)}) Not Found [Repeated Iteration | Probably Removed Manually]")
56
- except Exception as error:
1
+ import os
2
+ import shutil
3
+ import subprocess
4
+ import pathlib
5
+
6
+ def get_folder(folder_path, loc = False):
7
+ src = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data", pathlib.Path(folder_path))
8
+ try:
9
+ dest = os.path.join(os.getcwd(), pathlib.Path(folder_path))
10
+ shutil.copytree(src, dest, symlinks=False, copy_function = shutil.copy2,
11
+ ignore=shutil.ignore_patterns('.ipynb_checkpoints', '__init__.py', '__pycache__'),
12
+ ignore_dangling_symlinks=False, dirs_exist_ok=True)
13
+ except:
14
+ try:
15
+ dest = os.path.join(os.path.expanduser('~'), "Downloads", pathlib.Path(folder_path))
16
+ shutil.copytree(src, dest, symlinks=False, copy_function = shutil.copy2,
17
+ ignore=shutil.ignore_patterns('.ipynb_checkpoints', '__init__.py', '__pycache__'),
18
+ ignore_dangling_symlinks=False, dirs_exist_ok=True)
19
+ except Exception as error:
20
+ print(error)
21
+ return
22
+ finally:
23
+ if loc:
24
+ print("Path:",dest)
25
+
26
+ def get_file(file_path, loc = False, open = False):
27
+ src = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data", pathlib.Path(file_path))
28
+ try:
29
+ dest = os.path.join(os.getcwd(), pathlib.Path(file_path).name)
30
+ shutil.copy(src, dest)
31
+ if open:
32
+ subprocess.Popen(f"jupyter notebook {dest}")
33
+ except:
34
+ try:
35
+ dest = os.path.join(os.path.expanduser('~'), "Downloads", pathlib.Path(file_path).name)
36
+ shutil.copy(src, dest)
37
+ except Exception as error:
38
+ print(error)
39
+ finally:
40
+ if loc:
41
+ print("Path:",dest)
42
+
43
+ def remove_folder(folder_path):
44
+ try:
45
+ src1 = os.path.join(os.getcwd(), pathlib.Path(folder_path))
46
+ src2 = os.path.join(os.path.expanduser('~'), "Downloads", pathlib.Path(folder_path))
47
+ if os.path.exists(src1) or os.path.exists(src2):
48
+ shutil.rmtree(src1, ignore_errors = True)
49
+ shutil.rmtree(src2, ignore_errors = True)
50
+ if os.path.exists(src1) or os.path.exists(src2):
51
+ print("Deletion Impossible [File Not Closed - Shutdown File Kernel]\nGo to Home page -> Running Tab -> Click Shut Down All")
52
+ else:
53
+ print(f"Folder({pathlib.Path(folder_path)}) Removed Successfully")
54
+ else:
55
+ print(f"Folder({pathlib.Path(folder_path)}) Not Found [Repeated Iteration | Probably Removed Manually]")
56
+ except Exception as error:
57
57
  print(error)
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 The author
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1
+ MIT License
2
+
3
+ Copyright (c) 2025 The author
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  THE SOFTWARE.
@@ -1,55 +1,55 @@
1
- Metadata-Version: 2.2
2
- Name: noshot
3
- Version: 0.2.4
4
- Summary: Support library for Artificial Intelligence, Machine Learning and Data Science tools
5
- Author: Tim Stan S
6
- License: MIT
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: Programming Language :: Python :: 3.7
9
- Classifier: Programming Language :: Python :: 3.8
10
- Classifier: Programming Language :: Python :: 3.9
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Operating System :: OS Independent
15
- Requires-Python: >=3.7
16
- Description-Content-Type: text/markdown
17
- License-File: LICENSE.txt
18
- Dynamic: author
19
- Dynamic: classifier
20
- Dynamic: description
21
- Dynamic: description-content-type
22
- Dynamic: license
23
- Dynamic: requires-python
24
- Dynamic: summary
25
-
26
- <h1 align="center">No Shot</h1>
27
-
28
- <p align="center">
29
- <img src="https://i.ibb.co/XkjpGzzL/noshot.jpg" alt="No Shot Image" width="400">
30
- </p>
31
-
32
- ![Static Badge](https://img.shields.io/badge/OneShotCoding-NoShot-blue?logoColor=yell)
33
- [![PyPI - Version](https://img.shields.io/pypi/v/noshot)](https://pypi.org/project/noshot)
34
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/suganthangnanavelan/one-shot-coding/blob/main/LICENSE.txt)
35
- [![Pepy Total Downloads](https://img.shields.io/pepy/dt/noshot)](https://pepy.tech/projects/noshot)
36
- ![Python Versions](https://img.shields.io/pypi/pyversions/noshot.svg?logo=python&color=yellow)
37
- ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/suganthangnanavelan/one-shot-coding/test.yml)
38
-
39
- <p align="center">
40
- A powerful support library that enhances the capabilities of NumPy, Pandas, and Matplotlib by providing additional algorithms, visualizations, and utilities.
41
- </p>
42
-
43
- ## 🚀 **Overview**
44
- `NoShot` is a utility library that acts as a **support dependency** for larger modules like **NumPy, Pandas, and Matplotlib**. It enhances their functionality by introducing:
45
- - 📊 **Custom visualizations** built on top of Matplotlib.
46
- - 📈 **Optimized algorithms** for data processing.
47
- - ⚡ **Additional utilities** for working with structured data.
48
-
49
- > [!NOTE]
50
- > This package is **not a replacement** for NumPy or Pandas but extends their features to simplify complex operations.
51
-
52
- ## 📦 **Installation**
53
- Install latest version via `pip`:
54
- ```sh
55
- pip install noshot==0.2.0
1
+ Metadata-Version: 2.2
2
+ Name: noshot
3
+ Version: 0.2.6
4
+ Summary: Support library for Artificial Intelligence, Machine Learning and Data Science tools
5
+ Author: Tim Stan S
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.7
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.7
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE.txt
18
+ Dynamic: author
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: license
23
+ Dynamic: requires-python
24
+ Dynamic: summary
25
+
26
+ <h1 align="center">No Shot</h1>
27
+
28
+ <p align="center">
29
+ <img src="https://i.ibb.co/XkjpGzzL/noshot.jpg" alt="No Shot Image" width="400">
30
+ </p>
31
+
32
+ ![Static Badge](https://img.shields.io/badge/OneShotCoding-NoShot-blue?logoColor=yell)
33
+ [![PyPI - Version](https://img.shields.io/pypi/v/noshot)](https://pypi.org/project/noshot)
34
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/suganthangnanavelan/one-shot-coding/blob/main/LICENSE.txt)
35
+ [![Pepy Total Downloads](https://img.shields.io/pepy/dt/noshot)](https://pepy.tech/projects/noshot)
36
+ ![Python Versions](https://img.shields.io/pypi/pyversions/noshot.svg?logo=python&color=yellow)
37
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/suganthangnanavelan/one-shot-coding/test.yml)
38
+
39
+ <p align="center">
40
+ A powerful support library that enhances the capabilities of NumPy, Pandas, and Matplotlib by providing additional algorithms, visualizations, and utilities.
41
+ </p>
42
+
43
+ ## 🚀 **Overview**
44
+ `NoShot` is a utility library that acts as a **support dependency** for larger modules like **NumPy, Pandas, and Matplotlib**. It enhances their functionality by introducing:
45
+ - 📊 **Custom visualizations** built on top of Matplotlib.
46
+ - 📈 **Optimized algorithms** for data processing.
47
+ - ⚡ **Additional utilities** for working with structured data.
48
+
49
+ > [!NOTE]
50
+ > This package is **not a replacement** for NumPy or Pandas but extends their features to simplify complex operations.
51
+
52
+ ## 📦 **Installation**
53
+ Install latest version via `pip`:
54
+ ```sh
55
+ pip install noshot==0.2.0
@@ -0,0 +1,9 @@
1
+ noshot/__init__.py,sha256=000R40tii8lDFU8C1fBaD3SOnxD0PWRNWZU-km49YrU,21
2
+ noshot/main.py,sha256=6gU5gZ5csHxJQ7H-YyWVkW51hJIZdV9cqsPBDTjFo9s,645
3
+ noshot/utils/__init__.py,sha256=NovRMat6RWu1WNI1_OH_Xo6Uvaq8D91no-ZhLcuVwHs,108
4
+ noshot/utils/shell_utils.py,sha256=WzVq5EZEgiJFysbDYn9QPRYSE555Ew20HZbb3RDymkE,2555
5
+ noshot-0.2.6.dist-info/LICENSE.txt,sha256=MLVZLpViyRWQLkQCesNwRqdfGzt-aunQSFiP5b_5Qn4,1066
6
+ noshot-0.2.6.dist-info/METADATA,sha256=_dbpGfCZgUT6bXV95asg2LYqZtnFPn8QkNC0tQoZkx8,2398
7
+ noshot-0.2.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
8
+ noshot-0.2.6.dist-info/top_level.txt,sha256=UL-c0HffdRwohz-y9icY_rnY48pQDdxGcBsgyCKh2Q8,7
9
+ noshot-0.2.6.dist-info/RECORD,,
@@ -1,207 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "markdown",
5
- "id": "8c414eda",
6
- "metadata": {},
7
- "source": [
8
- "##### __Machine learnings Laboratory First Lab Basic EDA and Principle components analysis__"
9
- ]
10
- },
11
- {
12
- "cell_type": "code",
13
- "execution_count": null,
14
- "id": "1919dce4",
15
- "metadata": {},
16
- "outputs": [],
17
- "source": [
18
- "import pandas as pd\n",
19
- "import numpy as np\n",
20
- "import matplotlib.pyplot as plt\n",
21
- "from sklearn.preprocessing import StandardScaler\n",
22
- "from sklearn.decomposition import PCA\n",
23
- "import warnings\n",
24
- "warnings.filterwarnings('ignore')"
25
- ]
26
- },
27
- {
28
- "cell_type": "code",
29
- "execution_count": null,
30
- "id": "459c19c9",
31
- "metadata": {},
32
- "outputs": [],
33
- "source": [
34
- "df = pd.read_table('input.txt', delimiter = ',', names = ['class name', 'left-weight', 'left-distance', 'right-weight', 'right-distance'])\n",
35
- "#df = pd.read_csv('balance-scale.csv')\n",
36
- "df.head()"
37
- ]
38
- },
39
- {
40
- "cell_type": "code",
41
- "execution_count": null,
42
- "id": "4a1f3399",
43
- "metadata": {},
44
- "outputs": [],
45
- "source": [
46
- "print(\"Shape\\t Size\")\n",
47
- "print(df.shape, df.size)\n",
48
- "df.dtypes"
49
- ]
50
- },
51
- {
52
- "cell_type": "code",
53
- "execution_count": null,
54
- "id": "ceb17e01",
55
- "metadata": {},
56
- "outputs": [],
57
- "source": [
58
- "df.describe()"
59
- ]
60
- },
61
- {
62
- "cell_type": "code",
63
- "execution_count": null,
64
- "id": "c3950e04",
65
- "metadata": {},
66
- "outputs": [],
67
- "source": [
68
- "df.info()"
69
- ]
70
- },
71
- {
72
- "cell_type": "code",
73
- "execution_count": null,
74
- "id": "e242d2e1",
75
- "metadata": {},
76
- "outputs": [],
77
- "source": [
78
- "plt.hist(df['class name'], color = 'green', label = 'Frequency Distribution')\n",
79
- "plt.legend()\n",
80
- "plt.title(\"Class Wise Count ['L', 'B', 'R']\")\n",
81
- "plt.show()"
82
- ]
83
- },
84
- {
85
- "cell_type": "code",
86
- "execution_count": null,
87
- "id": "37654636",
88
- "metadata": {},
89
- "outputs": [],
90
- "source": [
91
- "fig, axs = plt.subplots(2,2)\n",
92
- "axs[0][0].hist(df['left-weight'], color = 'orange', label = 'Left-Weight')\n",
93
- "axs[0][1].hist(df['left-distance'], color = 'red', label = 'Lefft-distance')\n",
94
- "axs[1][0].hist(df['right-weight'], color = 'green',label = 'right-weight')\n",
95
- "axs[1][1].hist(df['right-distance'], color = 'indigo', label = 'right-distance')\n",
96
- "fig.legend(loc = 'upper left')\n",
97
- "fig.suptitle(\"Histogram For Features\")"
98
- ]
99
- },
100
- {
101
- "cell_type": "markdown",
102
- "id": "3b033918",
103
- "metadata": {},
104
- "source": [
105
- "##### __PCA__"
106
- ]
107
- },
108
- {
109
- "cell_type": "code",
110
- "execution_count": null,
111
- "id": "b9d4bb7e",
112
- "metadata": {},
113
- "outputs": [],
114
- "source": [
115
- "feature = ['left-weight','left-distance','right-weight','right-distance']\n",
116
- "x = df.loc[:, feature]\n",
117
- "y = df.loc[:, 'class name']"
118
- ]
119
- },
120
- {
121
- "cell_type": "code",
122
- "execution_count": null,
123
- "id": "de2b55cc",
124
- "metadata": {},
125
- "outputs": [],
126
- "source": [
127
- "x = StandardScaler().fit_transform(x)\n",
128
- "pca = PCA(n_components = 2)\n",
129
- "pct = pca.fit_transform(x)"
130
- ]
131
- },
132
- {
133
- "cell_type": "code",
134
- "execution_count": null,
135
- "id": "06bf0d31",
136
- "metadata": {},
137
- "outputs": [],
138
- "source": [
139
- "principal_df = pd.DataFrame(pct,columns=['pc1','pc2'])\n",
140
- "print(\"principal-df:\\n\",principal_df)"
141
- ]
142
- },
143
- {
144
- "cell_type": "code",
145
- "execution_count": null,
146
- "id": "7dab85de",
147
- "metadata": {},
148
- "outputs": [],
149
- "source": [
150
- "finaldf= pd.concat([principal_df,df[['class name']]],axis=1)\n",
151
- "print(\"finaldf:\\n\",finaldf)"
152
- ]
153
- },
154
- {
155
- "cell_type": "code",
156
- "execution_count": null,
157
- "id": "026ab3b1",
158
- "metadata": {},
159
- "outputs": [],
160
- "source": [
161
- "finaldf.head()"
162
- ]
163
- },
164
- {
165
- "cell_type": "code",
166
- "execution_count": null,
167
- "id": "53d0455b",
168
- "metadata": {},
169
- "outputs": [],
170
- "source": [
171
- "fig = plt.figure(figsize = (8, 8))\n",
172
- "ax = fig.add_subplot(1, 1, 1)\n",
173
- "ax.set_xlabel('Principal Component 1', fontsize = 15)\n",
174
- "ax.set_ylabel('Principal Component 2', fontsize = 15)\n",
175
- "ax.set_title('2 component PCA', fontsize = 20)\n",
176
- "targets = ['L','B','R']\n",
177
- "colors = ['r', 'g','b']\n",
178
- "for target, color in zip(targets, colors):\n",
179
- " indicesToKeep = finaldf['class name'] == target\n",
180
- " ax.scatter(finaldf.loc[indicesToKeep, 'pc1'], finaldf.loc[indicesToKeep, 'pc2'], c = color, s = 50)\n",
181
- "ax.legend(targets)\n",
182
- "ax.grid()"
183
- ]
184
- }
185
- ],
186
- "metadata": {
187
- "kernelspec": {
188
- "display_name": "Python 3 (ipykernel)",
189
- "language": "python",
190
- "name": "python3"
191
- },
192
- "language_info": {
193
- "codemirror_mode": {
194
- "name": "ipython",
195
- "version": 3
196
- },
197
- "file_extension": ".py",
198
- "mimetype": "text/x-python",
199
- "name": "python",
200
- "nbconvert_exporter": "python",
201
- "pygments_lexer": "ipython3",
202
- "version": "3.12.4"
203
- }
204
- },
205
- "nbformat": 4,
206
- "nbformat_minor": 5
207
- }