question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[RMP] Make losses, metrics, masking, and negative sampling configurable from `model.compile()`

See original GitHub issue

During our paper research, we thought we could implement models from papers and get results that beat simple baselines. That didn’t turn out to be true, so we need to figure out why. We found that some of the experiments we wanted to run to improve performance weren’t supported by the current state of the library, so we’d like to make some API changes to support the effort to improve model performance to the point where it beats standard baselines. We’re now committed to doing a KDD tutorial in August where we want to show working models with good performance, so now is the time to make these changes in order to support our continued efforts to produce performant models.

Prototype PR for exploring design decisions:

Smaller pieces to do individually: ( Note: These dev tasks will be moved to separate roadmap items and planned in future releases )

  • Migrate toward the standard Keras API
  • Simplify the design of negative sampling
    • Make it more explicit what gets called when and what’s happening
    • Classes renamed to make the concepts clearer
  • Make negative sampling work for ranking models
    • Allow putting item ids on the queue (instead of item embeddings)
  • Make it possible to save a full two-tower model (instead of just the individual towers)
    • Include the queue state
    • Include the negative sampling strategy
  • Improve the design of masking
    • Allow users to specify which feature you want to mask (instead of assuming only the item id)
    • Improve how the masking is passed through the model (from the inputs to the targets)

Related PRs:

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marcromeyncommented, May 16, 2022

Current progress:

CleanShot 2022-05-16 at 18 39 06

0reactions
viswa-nvidiacommented, Jul 5, 2022

Simplify the design of negative sampling Make it more explicit what gets called when and what’s happening Classes renamed to make the concepts clearer Make negative sampling work for ranking models Allow putting item ids on the queue (instead of item embeddings) Make it possible to save a full two-tower model (instead of just the individual towers) Include the queue state Include the negative sampling strategy

The above tasks will move to the negative sampling ticket https://github.com/NVIDIA-Merlin/Merlin/issues/413

the following work requires its own Roadmap ticket which Marc will create. This is a dependency for session based recommmenders and the rough plan is to visit this post recsys. Design discusions will happen prior to REcyss Improve the design of masking Allow users to specify which feature you want to mask (instead of assuming only the item id) Improve how the masking is passed through the model (from the inputs to the targets)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loss and metrics differ with masking or sample weights #34158
I compile the model with a loss of 'mean_squared_error' and a metric of 'mean_squared_error' , but the output is different when the mask...
Read more >
How to Use Metrics for Deep Learning with Keras in Python
The Keras library provides a way to calculate and report on a suite of standard metrics when training deep learning models.
Read more >
tf.keras.optimizers.experimental.RMSprop | TensorFlow v2.11.0
Optimizer that implements the RMSprop algorithm.
Read more >
Keras - Model Compilation - Tutorialspoint
A sample code to compile the mode is as follows − from keras import losses from keras import optimizers from keras import metrics...
Read more >
Best way to handle negative sampling in Tensorflow 2.0 with ...
Code to implement Negative Sampling in Keras is shown below: # create some input variables input_target = Input((1,)) input_context ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found