Older neg sampling
@@ -1011,8 +1011,8 @@ def optimize_layout(embedding, positive_head, positive_tail,
dim = embedding.shape[1]
alpha = initial_alpha
- # epochs_per_negative_sample = epochs_per_sample / negative_sample_rate
- # epoch_of_next_negative_sample = epochs_per_negative_sample.copy()
+ epochs_per_negative_sample = epochs_per_sample / negative_sample_rate
+ epoch_of_next_negative_sample = epochs_per_negative_sample.copy()
epoch_of_next_sample = epochs_per_sample.copy()
for n in range(n_epochs):
@@ -1036,8 +1036,8 @@ def optimize_layout(embedding, positive_head, positive_tail,
epoch_of_next_sample[i] += epochs_per_sample[i]
- # while epoch_of_next_negative_sample[i] <= n:
- for i in range(negative_sample_rate):
+ while epoch_of_next_negative_sample[i] <= n:
+ # for i in range(negative_sample_rate):
# edge = tau_rand_int(rng_state) % (n_vertices ** 2)
# j = edge // n_vertices
k = tau_rand_int(rng_state) % n_vertices
@@ -1059,8 +1059,8 @@ def optimize_layout(embedding, positive_head, positive_tail,
current[d] += grad_d * alpha
other[d] += -grad_d * alpha
- # epoch_of_next_negative_sample[i] += \
- # epochs_per_negative_sample[i]
+ epoch_of_next_negative_sample[i] += \
+ epochs_per_negative_sample[i]
alpha = initial_alpha * (1.0 - (float(n) / float(n_epochs)))
