lyst / lyst/lightfm

How to validate the Dataset.mapping

Open
#670 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Using the same example from https://making.lyst.com/lightfm/docs/examples/dataset.html#building-the-id-mappings

How could I validade the mapping of each item feature?

When I call ```user_id_map, u_f_map, item_id_map, i_f_map = dataset.mapping()```

after this
```item_features = dataset.build_item_features(((x['ISBN'], [x['Book-Author']]) for x in get_book_features()))```

I got this result from item_id_map
```
{'034545104X': 0,
'0155061224': 1,
'0446520802': 2,
'052165615X': 3...}
```
Now, I know that '034545104X' is mapped as 0. Looking at item_features built before I got this

```
(0, 0) 0.5
(0, 343789) 0.5
(1, 1) 0.5
(1, 428522) 0.5
(2, 2) 0.5
(2, 341954) 0.5
(3, 3) 0.5 .......
```

Looking at ```book_features``` as a pandas dataframe
![dede](https://user-images.githubusercontent.com/84594190/205651559-07189fc1-1d4c-4b6c-b365-e1653e71a7b6.png)

As seen, getting the item mapped as 0 which is the item 034545104X. And filtering the dataframe, for this item, the book-author is `Flesh Tones: A Novel`

But When I do this
```
item_feature_inverse_map = {v:k for k, v in i_f_map.items()}
print(item_feature_inverse_map[343789])
```

The result is `'M. J. Rose'` which is different of `Flesh Tones: A Novel`.

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

Start with the Dataset.mapping() and build_item_features() entry points, using the linked dataset example as the initial reference. Trace how item IDs and item-feature IDs are assigned, then document or clarify the expected inverse mapping behavior and validate it against the reported ISBN and author values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.