Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
"source": [
"%%time\n",
"item_features_names = ['f_' + str(col) for col in [47, 68]]\n",
"cat_features = [['item_id', 'purchase_id']] + item_features_names >> nvt.ops.Categorify(start_index=1)\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we can add a note for the user something like that:

Categorify op maps nulls to `1`, OOVs to `2` and the frequent categories are encoded starting from `3`. Please note that we reserve `0` for padding value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can I propose merging this fix to get things working then you can update the copy?

"cat_features = [['item_id', 'purchase_id']] + item_features_names >> nvt.ops.Categorify()\n",
"\n",
"features = ['session_id', 'timestamp'] + cat_features"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/usecases/transformers-next-item-prediction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
"\n",
"categorical_features = (['city_id', 'booker_country', 'hotel_country'] +\n",
" weekday_checkin + weekday_checkout\n",
" ) >> ops.Categorify(start_index=1) \n",
" ) >> ops.Categorify()\n",
"\n",
"groupby_features = categorical_features + ['utrip_id', 'checkin'] >> ops.Groupby(\n",
" groupby_cols=['utrip_id'],\n",
Expand Down
2 changes: 1 addition & 1 deletion merlin/datasets/ecommerce/booking/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def default_booking_transformation(**kwargs):
Returns:
Workflow: NVTabular workflow
"""
cat = lambda: nvt.ops.Categorify(start_index=1) # noqa: E731
cat = lambda: nvt.ops.Categorify() # noqa: E731

df_season = get_lib().DataFrame(
{"month": range(1, 13), "season": ([0] * 3) + ([1] * 3) + ([2] * 3) + ([3] * 3)}
Expand Down