tensorflow / tensorflow/recommenders

Usage of the parameter of candidate_ids and num_hard_negatives?

Open
#330 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2k
Forks
300
PR merge metrics
No merged PRs in 30d

Description

parameter num_hard_negatives: when i set it as an integer lower than batch_size, the loss would not slow down.
parameter candidate_ids : I do not know how to use it.
I will be grateful if anyone knows the usage of the above parameters and leave a message to me!

tfrs.tasks.Retrieval(
loss: Optional[tf.keras.losses.Loss] = None,
metrics: Optional[tfrs.metrics.FactorizedTopK] = None,
temperature: Optional[float] = None,
num_hard_negatives: Optional[int] = None,
name: Optional[Text] = None
) -> None

call(
query_embeddings: tf.Tensor,
candidate_embeddings: tf.Tensor,
sample_weight: Optional[tf.Tensor] = None,
candidate_sampling_probability: Optional[tf.Tensor] = None,
candidate_ids: Optional[tf.Tensor] = None,
compute_metrics: bool = True
) -> tf.Tensor

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the tfrs.tasks.Retrieval API and its call signature, focusing on num_hard_negatives and candidate_ids. Review the surrounding API documentation or implementation to determine their intended inputs and behavior; done means providing clear usage guidance for both parameters, including the reported lower-than-batch_size case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.