lyst / lyst/lightfm

How to handle multi label features with the dataset construction?

Open
#372 9 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
5.1k
Forks
724
PR merge metrics
No merged PRs in 30d

Description

Hello! Thanks a lot for this amazing recommender system.

I have a question regarding the procedure of creating the one-hot encoding feature matrices.

Example: I have scenario where items have a feature called "tags", which means that an item may be associated with several tags. I really want to use the provided dataset module to create the necessary mappings and matrices, but I do not understand the best way to go about it. I see two options, but would love to know if there is another, more convenient way, and I imagine that more people have this problem.

| Item |provider| Tags |
| ----- |---| ----- |
| itemA | providerX | Tag1 |
| itemB | providerZ | [Tag1, Tag2, Tag3] |

1. Format the input to the build_item_features() function as following:

| Item |provider| Tags |
| ----- |---| ----- |
| itemA | providerX | Tag1 |
| itemB | providerZ | Tag1 |
| itemB | providerZ | Tag2 |
| itemB | providerZ | Tag3 |

This would however increase the one-hot encoded weight on the "provider" feature to 3. Which means that in the end I set all feature values >1 equal to 1. But is this the way to go?

2. The second option is to do it all manually, which would be a shame since you got this powerful functionality for it.

Thanks in advance for any advice.

best,

Morgan

Contributor guide

No contributing guide indexed for this repository

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

The issue discusses multi-label item features and the dataset construction API, but names no implementation files or tests. Start by locating the dataset feature-building entry point and reviewing how repeated item-feature rows are encoded. A useful outcome would require a decided supported approach for multi-label features, with corresponding documentation and tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.