Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set lower value for clipping in SamplingProbablityCorrection #567

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tensorflow_recommenders/layers/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

MAX_FLOAT = np.finfo(np.float32).max / 100.0
MIN_FLOAT = np.finfo(np.float32).min / 100.0
EPS_FLOAT = np.finfo(np.float32).eps / 100.0


def _gather_elements_along_row(data: tf.Tensor,
Expand Down Expand Up @@ -155,4 +156,4 @@ def __call__(self, logits: tf.Tensor,
"""Corrects the input logits to account for candidate sampling probability."""

return logits - tf.math.log(
tf.clip_by_value(candidate_sampling_probability, 1e-6, 1.))
tf.clip_by_value(candidate_sampling_probability, EPS_FLOAT, 1.))