|
|
@@ -31,7 +31,7 @@ def sample_function_mixed(user_train, usernum, itemnum, batch_size, maxlen, resu |
|
|
|
|
|
|
|
seq = np.zeros([maxlen], dtype=np.int32) |
|
|
|
pos = np.zeros([maxlen], dtype=np.int32) |
|
|
|
neg = np.zeros([maxlen*10], dtype=np.int32) |
|
|
|
neg = np.zeros([maxlen*30], dtype=np.int32) |
|
|
|
|
|
|
|
if len(user_train[user]) < maxlen: |
|
|
|
nxt_idx = len(user_train[user]) - 1 |
|
|
@@ -60,8 +60,11 @@ def sample_function_mixed(user_train, usernum, itemnum, batch_size, maxlen, resu |
|
|
|
# support_negative_triples.append([seq[idx],curr_rel,neg[idx]]) |
|
|
|
# support_negative_triples.append([seq[-1], curr_rel, neg[idx]]) |
|
|
|
|
|
|
|
for idx in range(maxlen*10 - 1): |
|
|
|
support_negative_triples.append([seq[-1], curr_rel, neg[idx]]) |
|
|
|
# for idx in range(maxlen*30 - 1): |
|
|
|
# support_negative_triples.append([seq[-1], curr_rel, neg[idx]]) |
|
|
|
for j in range(30): |
|
|
|
for idx in range(maxlen-1): |
|
|
|
support_negative_triples.append([seq[idx], curr_rel, neg[j*maxlen + idx]]) |
|
|
|
|
|
|
|
query_triples.append([seq[-1],curr_rel,pos[-1]]) |
|
|
|
negative_triples.append([seq[-1],curr_rel,neg[-1]]) |