Why put the test[u][0] into the candidate seqences?
BEbillionaireUSD opened this issue · 6 comments
In the evaluate function, it makes a item_index list and put the test[u][0] in it.
What I consider is that the test[u][0] should be what we want to predict, but in this way, the model knows it should predict from the possibility of these candidates, including the one we want to predict.
Is this a kind of data leaking? Or did I misunderstand something?
Specifically, what I mean is this part
for i in reversed(train[u]):
seq[idx] = i
idx -= 1
if idx == -1: break
rated = set(train[u])
rated.add(0)
item_idx = []#[test[u][0]]
for _ in range(101):
t = np.random.randint(1, itemnum + 1)
while t in rated: t = np.random.randint(1, itemnum + 1)
item_idx.append(t)
predictions = -model.predict(*[np.array(l) for l in [[u], [seq], item_idx]])
Thanks for your quick reply!
But there is another function to calculate the validation recall rate, i.e., "evaluate_valid()"
In the function, it doesn't involve test but adds the valid item into the item_index
Here is the function:
rated = set(train[u])
rated.add(0)
item_idx = [valid[u][0]]
for _ in range(100):
t = np.random.randint(1, itemnum + 1)
while t in rated: t = np.random.randint(1, itemnum + 1)
item_idx.append(t)
predictions = -model.predict(sess, [u], [seq], item_idx)
predictions = predictions[0]
My understanding of this phase is that: The model randomly chooses 100 candidates from all items (except those that have appeared before ) and adds the one it wants to predict into the candidate set. Then it predicts the probability of these 101 candidates.
The loop seems to be a little bit strange.
Thanks! But what if I want to predict the next item without knowing the real-next-item? Let item_index contains all items?
Hi ,
I would like to know the answer to same question asked by the CherlyLbt.
How do we predict the next item without knowing the real-next item?..
Thanks
coolsubbu