tensorflow / tensorflow/recommenders

[Question] TFX Evaluator in a recommender pipeline

Open
#657 2 comments 0 reactions 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

I apologize if an issue isn't the appropriate place for my question - but if what I am trying to do here is sensible/possible then maybe this could be considered a documentation improvement request.

In the recommender retrieval + TFX tutorial, we go from training the model to exporting it. In the Keras + TFX tutorial, they show how to use the Evaluator component. I am trying to add the Evaluator component to the retrieval pipeline but I am having trouble figuring out how to instantiate the EvalConfig (specifically, I am having trouble with the metrics).

I will start with my general questions, and if it would be helpful I can post what I have already tried.

  1. Is using the Evaluator component in the retrieval pipeline a sensible thing to do, or is there a reason it wasn't included in the example? By sensible here, I mean is there anything preventing us from comparing two retrieval models?
  2. If it is sensible to use the Evaluator component, could someone please share a code snippet (eval_config, model_resolver, evaluator) with me for what it would look like in the retrieval pipeline example for the case where we want to compare against the latest blessed model?
  3. What would be an appropriate metric for comparing two retrieval models?
    • I tried the FactorizedTopK metric, but I couldn't figure out:
      • how to pass the candidates in the tfma.MetricConfig
      • how to define thresholds for a metric that returns a collection of scores (for each k)
      • whether it was fair to use a metric to compare a candidate and blessed model which used the product_model that was trained alongside the candidate user_model
    • from here, it seems like NDCG or MinLabelPosition could be options although I don't really understand either of them (a simple explanation would be greatly appreciated) and MinLabelPosition in particular seems to only be applicable for ranking?
      • for these, I again don't know how to specify thresholds for them when the metrics_specs are created using tfma.metrics.specs_from_metrics(...)

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 with the linked TFX recommender and Keras+TFX tutorials, then review the Evaluator, EvalConfig, ModelResolver, and TFMA metric configuration entry points mentioned in the question. The work is done when the project has a decided recommendation about evaluating retrieval models, an appropriate metric and threshold approach, and a documented example or explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
documentation, machine-learning
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.