Skip to content

Commit

Permalink
Removed drop_duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
myui committed Jan 8, 2025
1 parent 028a17b commit 0b60efa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rtrec/recommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def fit(

# If train_data contains user_tags and item_tags columns, add them to the model
if "user_tags" in train_data.columns:
user_tags = train_data[["user", "user_tags"]].drop_duplicates()
user_tags = train_data[["user", "user_tags"]]
for user, tags in user_tags.itertuples(index=False, name=None):
self.model.register_user_feature(user, tags)
if "item_tags" in train_data.columns:
item_tags = train_data[["item", "item_tags"]].drop_duplicates()
item_tags = train_data[["item", "item_tags"]]
for item, tags in item_tags.itertuples(index=False, name=None):
self.model.register_item_feature(item, tags)

Expand Down Expand Up @@ -77,11 +77,11 @@ def bulk_fit(self, train_data: pd.DataFrame, batch_size: int = 1_000, update_int

# If train_data contains user_tags and item_tags columns, add them to the model
if "user_tags" in train_data.columns:
user_tags = train_data[["user", "user_tags"]].drop_duplicates()
user_tags = train_data[["user", "user_tags"]]
for user, tags in user_tags.itertuples(index=False, name=None):
self.model.register_user_feature(user, tags)
if "item_tags" in train_data.columns:
item_tags = train_data[["item", "item_tags"]].drop_duplicates()
item_tags = train_data[["item", "item_tags"]]
for item, tags in item_tags.itertuples(index=False, name=None):
self.model.register_item_feature(item, tags)

Expand Down

0 comments on commit 0b60efa

Please sign in to comment.