Fix for issue -- don't negative sample yourself
@@ -806,6 +806,8 @@ def optimize_layout(
grad_coeff /= (0.001 + dist_squared) * (
a * pow(dist_squared, b) + 1
)
+ elif j == k:
+ continue
else:
grad_coeff = 0.0
