|
6 | 6 | Notes: |
7 | 7 | - Each column of the features matrix corresponds to a class item |
8 | 8 | """ |
| 9 | + |
9 | 10 | """ |
10 | 11 | Implementation of dimensionality reduction algorithms. |
11 | 12 |
|
@@ -123,7 +124,7 @@ def covariance_between_classes( |
123 | 124 | def principal_component_analysis(features: np.ndarray, dimensions: int) -> np.ndarray: |
124 | 125 | """Principal Component Analysis (PCA). |
125 | 126 |
|
126 | | - For more details: https://en.wikipedia.org/wiki/Principal_component_analysis |
| 127 | + For more details: https://en.wikipedia.org/wiki/Principal_component_analysis |
127 | 128 |
|
128 | 129 | Args: |
129 | 130 | features: Input features matrix (n_features x n_samples). |
@@ -157,7 +158,7 @@ def linear_discriminant_analysis( |
157 | 158 | ) -> np.ndarray: |
158 | 159 | """Linear Discriminant Analysis (LDA). |
159 | 160 |
|
160 | | - For more details: https://en.wikipedia.org/wiki/Linear_discriminant_analysis |
| 161 | + For more details: https://en.wikipedia.org/wiki/Linear_discriminant_analysis |
161 | 162 |
|
162 | 163 | Args: |
163 | 164 | features: Input features matrix (n_features x n_samples). |
@@ -198,7 +199,7 @@ def locally_linear_embedding( |
198 | 199 | ) -> np.ndarray: |
199 | 200 | """Locally Linear Embedding (LLE). |
200 | 201 |
|
201 | | - For more details: https://en.wikipedia.org/wiki/Nonlinear_dimensionality_reduction |
| 202 | + For more details: https://en.wikipedia.org/wiki/Nonlinear_dimensionality_reduction |
202 | 203 |
|
203 | 204 | Args: |
204 | 205 | features: Input features matrix (shape: [n_features, n_samples]). |
@@ -283,7 +284,7 @@ def multidimensional_scaling( |
283 | 284 | ) -> np.ndarray: |
284 | 285 | """Multidimensional Scaling (MDS). |
285 | 286 |
|
286 | | - For more details: https://en.wikipedia.org/wiki/Multidimensional_scaling |
| 287 | + For more details: https://en.wikipedia.org/wiki/Multidimensional_scaling |
287 | 288 |
|
288 | 289 | Args: |
289 | 290 | features: Input features matrix (shape: [n_features, n_samples]). |
@@ -429,9 +430,7 @@ def test_principal_component_analysis() -> None: |
429 | 430 | """Test function for Principal Component Analysis.""" |
430 | 431 | features = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) |
431 | 432 | dimensions = 2 |
432 | | - expected_output = np.array( |
433 | | - [[6.92820323, 8.66025404, 10.39230485], [3.0, 3.0, 3.0]] |
434 | | - ) |
| 433 | + expected_output = np.array([[6.92820323, 8.66025404, 10.39230485], [3.0, 3.0, 3.0]]) |
435 | 434 |
|
436 | 435 | output = principal_component_analysis(features, dimensions) |
437 | 436 | if not np.allclose(expected_output, output): |
|
0 commit comments