-
Notifications
You must be signed in to change notification settings - Fork 65
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
Question on indices mapping - pure collaborative-filtering example #12
Comments
I have also encountered this for the you tube model and i am also working on tracing it back to the original id numbers for both item and user. My mapping differs from the original user id number. Does this also change for the item id, and how can we match this back? @massquantity -Can you please provide clarity on the you tube model as well, instead of us creating a new issue? |
Well sorry guys, I think this whole id-mapping thing needs a more thorough design. @property
def user2id(self):
unique = np.unique(self.interaction_data["user"])
u2id = dict(zip(unique, range(self.n_users)))
u2id[-1] = len(unique) # -1 represent new user
return u2id Basically this operation maps original ids into range of [0, n_users]. Because it's way more convenient to deal with ids by mapping index first in the library. To get the original ids : >>> mapping_user = data_info.user2id # get dict of mapping from original index to index used in the library
>>> mapping_user[2124] = ...
>>> mapping_id = data_info.id2user # get dict of mapping from index used in the library to original index And this also works for |
Thanks 👍 |
Can you clarify how the map of indices works?
The text was updated successfully, but these errors were encountered: