NVIDIA-Merlin / NVIDIA-Merlin/Transformers4Rec

[QST] Categorifying nested lists in NVTabular and transformers4rec

Open
#792 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status/needs-triage
Dominant language
Python
Stars
1.3k
Forks
165
Avg merge
1m
Merged PRs (30d)
2

Description

❓ Questions & Help

Details

Hello everyone! In my sequential recommendation dataset every item actually comes annotated with a list of categories (potentially with repeated values). The following would be a pretty meaningful example.

data = [
    {"session_id": 1, "item_id-list": [101, 102, 103], "categories-list": [[A, B], [C, D], [E]]},
    {"session_id": 2, "item_id-list": [201, 202], "categories-list": [[A], [F, F]]}
]

Is it possible to categorify the categories present above in a nested way so that:

  • the lists [[A,B], [C,D], ..], .. do not become separate tokens but remain lists of categorified elements (e.g. [[1,2], [3,4], [6]] and [[1], [5,5]])
  • we can then feed those into EmbeddingBag downstream?

I've tried supplying the Dataset constructor with an appropriate schema, but unfortunately failed. I could also try flattening the lists categorifying and fusing back but this looks like a inefficient and bad idea..

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 by reviewing the Dataset constructor and the nested categories example to determine how list-of-list categorical data is represented. Compare the required representation with PyTorch EmbeddingBag inputs; done means repeated and nested categories remain categorified elements that can be consumed downstream without flattening and fusing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
data, machine-learning
Issue type
Feature
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.