maciejkula / spotlight

Deep recommender models using PyTorch.
MIT License
2.97k stars 421 forks source link

Could we train Implicit Sequence Models in a multi-label scenario? #156

Open JoaoLages opened 5 years ago

JoaoLages commented 5 years ago

instead of having only one single label (item) per position, have many instead. I dont know what losses we could use.

maciejkula commented 5 years ago

Are you trying to model a scenario where a user buys two or more items at the same time? You are right that this isn't supported here in a straightforward way.

lsatterfield commented 5 years ago

I'm not sure the intent of the original question but this is something I am also attempting to do.

I think about my sequences like this T1(p1,p2), T2(p1,p2,p3) where T is a transaction and p is a product. The transactions are ordered but the products are not ordered within a transaction.

The evaluation is easy enough ,the default Len(intersect)/Len(predictions)/Len(intersect)/Len(targets) slash F1 works just fine, just use T1 ... T1+i to predict Tn. You have to modify the evaluation function to separate by transaction instead of by masking the last k products and deal with potential repeat purchases within a transaction.

As far as the model goes however I'm not certain the current implementation works for semi sequential data. Do you have any thoughts about a way to extend the current model to handle a scenario like this?

Thank you for all the hard work on this amazing package.

lsatterfield commented 5 years ago

Come to think of it it may be possible to do some form of sub-sorting within transactions. My idea is to impose order in the training set. My initial thought is sorting within a transaction by the value of that product within the transaction (utility) so that value is always ascending within a transaction. Then you could manually assign custom timestamps to impose this order. This should work because the order of my prediction sequence isn't important.

JoaoLages commented 5 years ago

@maciejkula yeah, that's it. Each time step i could have more than one item associated with it. This would be very useful in cases where 'the order of the items is irrelevant'.