Skip to content

Commit 8cd7bf4

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 0c68d24 commit 8cd7bf4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

machine_learning/dimensionality_reduction.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ def linear_discriminant_analysis(
183183
# Add regularization to avoid singular matrix
184184
sw = covariance_within_classes(features, labels, classes)
185185
sb = covariance_between_classes(features, labels, classes)
186-
186+
187187
# Regularize the within-class covariance matrix
188188
reg_param = 1e-6
189189
sw_reg = sw + reg_param * np.eye(sw.shape[0])
190-
190+
191191
try:
192192
_, eigenvectors = eigh(sb, sw_reg)
193193
filtered_eigenvectors = eigenvectors[:, ::-1][:, :dimensions]
@@ -212,6 +212,7 @@ def linear_discriminant_analysis(
212212
logging.error("Dataset empty")
213213
raise AssertionError
214214

215+
215216
def locally_linear_embedding(
216217
features: np.ndarray, dimensions: int, n_neighbors: int = 12, reg: float = 1e-3
217218
) -> np.ndarray:

0 commit comments

Comments
 (0)