We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e7c4542 commit 0e8c395Copy full SHA for 0e8c395
.virtual_documents/testing.ipynb
@@ -0,0 +1,26 @@
1
+from sklearn.decomposition import SparsePCA
2
+import numpy as np
3
+
4
+# Generate example data
5
+X = np.array([[1, 2, 3],
6
+ [4, 5, 6],
7
+ [7, 8, 9]])
8
9
+# Perform Sparse PCA
10
+spca = SparsePCA(n_components=2, alpha=1)
11
+X_spca = spca.fit_transform(X)
12
13
+# Components
14
+print("Components:", spca.components_)
15
16
+# Transformed data
17
+print("Transformed data:", X_spca)
18
19
20
+X_spca.shape, X.shape
21
22
23
+X_spca, X
24
25
26
0 commit comments