tensorflow / tensorflow/recommenders
[Question] Change K in FactorizedTopK in Retrieval based on Input variable
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 300
- PR merge metrics
- No merged PRs in 30d
Description
Hi all,
Context:
I'm using Tensorflow Recommender to recommend SKUs to Users depending on the purchase History.
To divide the train and the test set I have used the date of purchase (e.g. 100 days in the history, first 70 days in train and last month in test).
Problem:
To evaluate the goodness of the model I am looking at the how many SKU's are inside each order.
I am using the order size to select the number of SKUs I want to recommend (e.g. in order "xy134" the user "mickey" has bought 4 SKUs, so I recommend him the best 4 SKUs extracte by TFRS) and I am evaluating the TopK based on how many suggestions were bought (e.g. i have recommended 4 SKUs to one order and 3 SKUs in a second, 2 of the SKUs recommended for the first order were bought while only 1 SKU was bought in the second. My TopK accuracy is (2+1)/(4+3) = 0.43)
Question:
Is possible to pass the order size as feature in the model to modify the number k of FactorizedTopK in Retrieval task and obtain after the validation a metric val_factorized_top_k/top_K_categorical_accuracy?
Right now to evaluate the TopK_categorical_accuracy I am training my model, then looping the test set to predict the recommendation for each line (using the order_size as k in factorized_top_k.BruteForce) and after that evaluating the accuracy, by adding in the model feature["order_size"] to FactorizedTopK in the Retrieval task (and creating this way a metric val_factorized_top_k/top_k_categorical_accuracy) i could look at the TopK accuracy with the model evaluation
Thanks,
Stefano
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the FactorizedTopK retrieval task and BruteForce evaluation APIs, then trace how the order_size feature and validation metric are passed through model evaluation. Determine whether K can vary per example and whether val_factorized_top_k/top_k_categorical_accuracy can represent this evaluation. Done means the supported approach is demonstrated or the limitation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100