scikit-pca-vis 0.1.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.
@@ -0,0 +1,3 @@
1
+ from .visualizer import run_pca
2
+
3
+ __all__ = ["run_pca"]
@@ -0,0 +1,31 @@
1
+ import numpy as np
2
+ from sklearn.decomposition import PCA
3
+ import matplotlib.pyplot as plt
4
+
5
+ def run_pca():
6
+ X = np.array([[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [1.5, 2.5], [4.5, 5.5]])
7
+
8
+ pca = PCA(n_components=1)
9
+ pca.fit(X)
10
+ X_transformed = pca.transform(X)
11
+
12
+ print("Original data points:\n", X)
13
+ print("\nTransformed data (1 Principal Component):\n", X_transformed)
14
+ print("\nExplained variance ratio of the principal component:", pca.explained_variance_ratio_)
15
+
16
+ plt.figure(figsize=(8, 6))
17
+ plt.scatter(X[:, 0], X[:, 1], label="Original Data Points")
18
+ plt.quiver(
19
+ pca.mean_[0], pca.mean_[1],
20
+ pca.components_[0, 0], pca.components_[0, 1],
21
+ scale=3, color="red", label="Principal Component Direction"
22
+ )
23
+ plt.xlabel("Feature 1")
24
+ plt.ylabel("Feature 2")
25
+ plt.title("PCA Example: Original Data and Principal Component")
26
+ plt.legend()
27
+ plt.grid(True)
28
+ plt.show()
29
+
30
+ if __name__ == "__main__":
31
+ run_pca()
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.5
2
+ Name: scikit-pca-vis
3
+ Version: 0.1.0
4
+ Summary: A lightweight PCA visualizer using scikit-learn and matplotlib
5
+ Requires-Python: >=3.8
6
+ Requires-Dist: matplotlib>=3.5.0
7
+ Requires-Dist: numpy>=1.20.0
8
+ Requires-Dist: scikit-learn>=1.0.0
9
+ Description-Content-Type: text/markdown
10
+
11
+ # scikit-pca-vis
12
+
13
+ A quick PCA demo and 2D visualizer built with scikit-learn and matplotlib.
14
+
15
+ ## Installation
16
+ ```bash
17
+ pip install scikit-pca-vis
@@ -0,0 +1,6 @@
1
+ scikit_pca_vis/__init__.py,sha256=7VaGRqERLkJpSWnAns2FtGBZLf4_5NRLWpmC4Rr6EKU,58
2
+ scikit_pca_vis/visualizer.py,sha256=FE3EbQ3ztfsWuVqQ9geg39MAvb3rv7ajg-pcY6f4ESg,1009
3
+ scikit_pca_vis-0.1.0.dist-info/METADATA,sha256=Lu6n_5m0vIPkqbEn2OJ3SMyxQd_7pNSAeYKGWvG4iHI,436
4
+ scikit_pca_vis-0.1.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
5
+ scikit_pca_vis-0.1.0.dist-info/entry_points.txt,sha256=4QhYMGqC9fpNrnQPZ36PLpCZv2GF1k9nKttsVwO9SxI,62
6
+ scikit_pca_vis-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pca-vis = scikit_pca_vis.visualizer:run_pca