lyst / lightfm

A Python implementation of LightFM, a hybrid recommendation algorithm.
Apache License 2.0
4.73k stars 691 forks source link

Excluding some negatives from training #637

Open mmosc opened 2 years ago

mmosc commented 2 years ago

Hi!

First of all, thank you for this great library!

I'm currently using it for extending and comparing some matrix factorisation models for recommendation. I am working on the LFM-2b dataset.

For design reasons, part of my interaction matrix (or rather an extended version of it) consists of a block of zeros, which however should NOT be considered while training. In other words, if we imagine to be using either BPR or WARP, the negative samples should never belong to this block.

To explain things better, I want to train on a matrix like this: inter_matrix with A, B, C being sparse matrices and 0 being an empty matrix. The model should NOT use the entries of the bottom-right block for training.

Is there a way to do this?

Thanks :)