Does anyone know what does the num_negatives mean? What is it for?
def get_train_samples(train_mat, num_negatives):
user_input, item_input, labels = [], [], []
num_user, num_item = train_mat.shape
for (u, i) in train_mat.keys():
user_input.append(u)
item_input.append(i)
labels.append(1)
# negative instances
for t in range(num_negatives):
j = np.random.randint(num_item)
while (u, j) in train_mat.keys():
j = np.random.randint(num_item)
user_input.append(u)
item_input.append(j)
labels.append(0)
return user_input, item_input, labels
This occurs here:
user_input, item_input, labels = get_train_samples(train_mat, NUM_NEGATIVES)
And here:
hist = model.fit([np.array(user_input), np.array(item_input)], np.array(labels),
epochs=EPOCHS, verbose=VERBOSE, shuffle=True, batch_size = BATCH_SIZE,
validation_data=([np.array(val_user_input), np.array(val_item_input)]),
callbacks=CALLBACKS)