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.

[BUG] Mismatch between total number of items and length of prediction logit values (end-to-end-session-based notebook)

See original GitHub issue

Bug description

In the example here (using the Tensorflow approach), after we perform ETL with NVTabular, train the model with Tensorflow, and deploy it into Triton Server, there is a mismatch in the length of prediction which makes it impossible (?) to understand prediction results! We have a total of 52739 item ids. However, if we try to predict recommended item for a few (new) sessions, the length of logit values is 52743. Therefore:

total number of existing items (52739) < total number of recommended options (52743)

Confirming total number of items

image

Checking the total number of predictions/recommendations

image

Could you please clarify if this is expected? As far as I understood, the visualized number is supposed to be the index of the ITEM ID to be recommended, so the full length of predictions and items should match.

image

Steps/Code to reproduce bug

  1. Follow the example here (using the Tensorflow approach)
  2. Try to resolve predictions. Compare the length of logit values in the prediction result and the length of total items in the initial dataset

Expected behavior

Full length of predicted logit values are equal to the number of items so that we could understand/resolve predicted items.

Environment details

  • Transformers4Rec version: 0.1.8
  • Platform: GCP - Linux (4vCPU, 15GB RAM, 1 Tesla T4 GPU)
  • Python version: 3.8.10
  • Huggingface Transformers version:
  • PyTorch version (GPU?):
  • Tensorflow version (GPU?): 2.8.0+nv22.4 - with GPU enabled

Additional context

Used nvcr.io/nvidia/merlin/merlin-training:22.05 image for training Used nvcr.io/nvidia/merlin/merlin-tensorflow-inference:22.05 for serving on Inference Server

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jacobdineencommented, Aug 10, 2022

@hosseinkalbasi If you call to_parquet() after fit_tranform on the nvtabular.workflow object, it will auto-generate a schema file stored in output_dir. e.g.,

dataset = nvt.Dataset(self.df)
workflow.fit_transform(dataset).to_parquet(output_dir)
1reaction
rnyakcommented, Aug 9, 2022

@hosseinkalbasi this is not really a bug. this is bcs we set the max num for the item-id column as follow in the schema_demo.pb. This schema file was created manually so it does not read the unique items from the NVT pipeline.

feature {
  name: "item_id-list_seq"
  value_count {
    min: 2
    max: 185
  }
  type: INT
  int_domain {
    name: "item_id/list"
    min: 1
    max: 52742
    is_categorical: true
  }

Please go to schema file and replace 52742 as 52739, and you should be getting +1 item_ids predicted for each session id. Hope that helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · NVIDIA-Merlin/Transformers4Rec - GitHub
[BUG] Mismatch between total number of items and length of prediction logit values (end-to-end-session-based notebook) bug Something isn't working P2.
Read more >
Predict Customer Churn in Python - Towards Data Science
Let's make use of a customer transaction dataset from Kaggle to understand the key steps involved in predicting customer attrition in Python.
Read more >
Logistic regression is predicting all 1, and no 0 - Cross Validated
The logit predicts the probability of default (PD) of a loan, which is a number between 0 and 1. Next, you set a...
Read more >
rms: Regression Modeling Strategies
solute error. Here, error refers to the difference between the predicted values and the corresponding bias-corrected calibrated values.
Read more >
How to Normalize and Standardize Time Series Data in Python
Normalization can be useful, and even required in some machine learning algorithms when your time series data has input values with ...
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