Sequence model with any loss other than adaptive_hinge recommends same items
mokarakaya opened this issue · 2 comments
I created the model as follows similar to the tests;
model = ImplicitSequenceModel(loss='pointwise',
representation='lstm',
batch_size=8,
learning_rate=1e-2,
l2=1e-3,
n_iter=10,
use_cuda=CUDA,
random_state=RANDOM_STATE)
And I recommend items to all sequences in test_seq. There are 229 sequences. So, in the loop below, I recommend k * 229 items.
However, all recommendations are same for any sequence in test_seq.
In order words, len(aggregate_diversity) = k for losses = pointwise or bpr
adaptive_hinge works well.
I've tried k =10 and k =20 and got the same results.
I've used Movielens 100K dataset.
Do I miss something?
sequences = test_seq.sequences[:, :-k]
aggregate_diversity = set()
for sequence in sequences:
predictions = -model.predict(sequence)
if exclude_preceding:
predictions[sequences] = FLOAT_MAX
predictions = predictions.argsort()[:k]
aggregate_diversity.update(predictions)
return len(aggregate_diversity)
It looks like your L2 regularization is very high. Can you try with a lower value?
Thanks for the quick reply.
Low L2 and high n_iter solved my issue;
l2=1e-10, n_iter=100,
The loss starts to decrease after around 60th epoch.
So, I think it was an underfitting problem.