Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to validate the Dataset.mapping #670

Open
marcosvliras opened this issue Dec 5, 2022 · 1 comment
Open

How to validate the Dataset.mapping #670

marcosvliras opened this issue Dec 5, 2022 · 1 comment

Comments

@marcosvliras
Copy link

marcosvliras commented Dec 5, 2022

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

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.

@saba-zones
Copy link

saba-zones commented Feb 3, 2024

Hi @marcosvliras. Were you able to run validations for these mappings on your dataset? If yes, how did you do it? I am also using lightfm dataset mappings, and want to do a similar thing. I need some tips on validating it with our original data/dataframe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants