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

ValueError: Error when checking input: expected user_input to have shape (1,) but got array with shape (3952,) #1

Open
starevelyn opened this issue Jan 10, 2022 · 1 comment

Comments

@starevelyn
Copy link

in the model:
def get_model(self):
user_input = Input(shape=(1,), dtype='int32', name='user_input')
item_input = Input(shape=(1,), dtype='int32', name='item_input')
but in evaluate.py is:
def _evaluate_one_rating(idx, k):
........
predictions = _model.predict([np.array(users_input), np.array(items_input)],
batch_size=100 + 1,
verbose=0)

@starevelyn
Copy link
Author

starevelyn commented Jan 10, 2022

solutions:
change code in evaluate.py:
def _evaluate_one_rating(idx, k):
.......
items_input = []
users_input = []
for item in items:
items_input.append(item) # original: _data_matrix[:, item]
users_input.append(user)

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

1 participant