Skip to content

Commit 0ef14c2

Browse files
committed
Fix Ruff linting errors E501 and EM102 in t-SNE implementation
Resolve line length violation (E501) and f-string literal in exception (EM102) by splitting error message and using variable assignment.
1 parent 7926720 commit 0ef14c2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

machine_learning/dimensionality_reduction.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,12 @@ def t_distributed_stochastic_neighbor_embedding(
229229
_, num_samples = features.shape
230230

231231
if num_samples < dimensions + 1:
232-
raise ValueError(
233-
f"Need at least {dimensions + 1} samples for t-SNE with {dimensions} dimensions, "
234-
f"but got {num_samples} samples"
232+
min_samples = dimensions + 1
233+
msg = (
234+
f"Need at least {min_samples} samples for t-SNE with {dimensions} "
235+
f"dimensions, but got {num_samples} samples"
235236
)
237+
raise ValueError(msg)
236238

237239
# Compute pairwise squared Euclidean distances
238240
def compute_pairwise_distances(data: np.ndarray) -> np.ndarray:

0 commit comments

Comments
 (0)