recommenders icon indicating copy to clipboard operation
recommenders copied to clipboard

remove num_candidates

Open evanfwelch opened this issue 4 years ago • 5 comments

Context

One nice feature of the tfrs.tasks.retrieval task is how simple it is. Especially how it dot products equal-sized of query and candidate embeddings and internally computes the "labels" as the identity matrix.

This PR

  • removes the computation and use of num_candidates as scores.shape[1]. The task doesn't support any kind of non-square score matrix as far as I can tell and having this extra degree of freedom actually made it harder for me to understand what was happening.

I would humbly suggest removing these bits for now and adding back in if there becomes a more general way to pass in candidates of a different shape.

evanfwelch avatar May 21 '21 05:05 evanfwelch

This actually supports an important feature - it's not publicly documented yet, but will be soon.

maciejkula avatar May 21 '21 16:05 maciejkula

Ok thanks @maciejkula would you like me to close it then?

evanfwelch avatar Jun 02 '21 15:06 evanfwelch

Hi @maciejkula, friendly nudge here... seems like this change makes things a bit clearer (since it seems like num_candidates == num_queires) but understood that you're suggesting that will eventually not be the case and you want to keep this.

evanfwelch avatar Aug 10 '21 04:08 evanfwelch

Yes, please!

maciejkula avatar Aug 16 '21 16:08 maciejkula

@evanfwelch with this proposed change we wouldn't be able to do Mixed Negative Sampling.

TimSchmeier avatar Jan 25 '22 04:01 TimSchmeier