Skip to content

[QST] #1110

@priyanshugupta69

Description

@priyanshugupta69

❓ Questions & Help

Details

I'm building a multi-stage recommendation model using NVIDIA Merlin. I want to include a list of IDs (e.g., [3, 3434, 4234, 344]) as part of the user or item features.

How can I incorporate such list features into the model pipeline?

What changes do I need to make in the following sample code from the official multi-stage recommendation notebook?

Do I need to modify anything else in the preprocessing workflow, schema, or model architecture, or are changes in just the provided code snippet sufficient?

user_id_raw = ["user_id"] >> Rename(postfix='_raw') >> LambdaOp(lambda col: col.astype("int32")) >> TagAsUserFeatures()
item_id_raw = ["item_id"] >> Rename(postfix='_raw') >> LambdaOp(lambda col: col.astype("int32")) >> TagAsItemFeatures()

item_cat = Categorify(dtype="int32")
items = (["item_id","item_category", "item_shop", "item_brand"] >> item_cat)

subgraph_item = Subgraph(
"item",
Subgraph("items_cat", items) +
(items["item_id"] >> TagAsItemID()) +
(items["item_category", "item_shop", "item_brand"] >> TagAsItemFeatures())
)
subgraph_user = Subgraph(
"user",
(["user_id"] >> Categorify(dtype="int32") >> TagAsUserID()) +
(
[
"user_shops",
"user_profile",
"user_group",
"user_gender",
"user_age",
"user_consumption_2",
"user_is_occupied",
"user_geography",
"user_intentions",
"user_brands",
"user_categories",
] >> Categorify(dtype="int32") >> TagAsUserFeatures()
)
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions