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

KeyError: 'the items in [item_features] do not match the items in [interactions]' #33

Open
srinivascnu166 opened this issue Jul 23, 2021 · 4 comments

Comments

@srinivascnu166
Copy link

item_features_train = pd.get_dummies(train_interactions[['Items', 'moment']], columns=['moment'])

I am classifying my items into fast, medium, slow moving items.
for this I am using the parameter "item_features".

It gives me this error:
model.fit(train_user_item, user_features=None, item_features=item_features_train, sample_weight=sample_weight_train, epochs=epochs, verbose=verbose) File "/usr/local/lib/python3.7/dist-packages/rankfm/rankfm.py", line 265, in fit self.fit_partial(interactions, user_features, item_features, sample_weight, epochs, verbose) File "/usr/local/lib/python3.7/dist-packages/rankfm/rankfm.py", line 289, in fit_partial self._init_all(interactions, user_features, item_features, sample_weight) File "/usr/local/lib/python3.7/dist-packages/rankfm/rankfm.py", line 135, in _init_all self._init_features(user_features, item_features) File "/usr/local/lib/python3.7/dist-packages/rankfm/rankfm.py", line 214, in _init_features raise KeyError('the items in [item_features] do not match the items in [interactions]') KeyError: 'the items in [item_features] do not match the items in [interactions]'
can someone help me with this?
And I have also gone through the example notebooks. I noticed that you have constructed the item features but not used it in instacart example. It would be if those notebooks were updated.

@KDKDKay
Copy link

KDKDKay commented Aug 8, 2021

I am also facing this issue. Did you happen to fix it?

@srinivascnu166
Copy link
Author

No

@srinivascnu166
Copy link
Author

Did you find any way to fix the issue @KDKDKay ?

@ErraticO
Copy link

model.fit(
    train_data[['user_id', 'item_id']],
    user_features=user_features,
    item_features=item_features,
    epochs=epochs,
    verbose=verbose
)

The unique_item_id of train_data and item_features is different.
You may have lost item_id in item_features.

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

3 participants