-
Notifications
You must be signed in to change notification settings - Fork 612
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
Python issue #705
Comments
model1.recommend(0,user_item_sparse1[0]) |
I think your issue is here: data_conf = (item_user_sparse1 * alpha_val).astype('double')
model1.fit(data_conf)
model1.recommend(0,user_item_sparse1[0]) The Does calling the model1.fit(user_item_sparse1)
model1.recommend(0,user_item_sparse1[0]) |
Hi guys i met trouble when i was trying to create a recommender system in python by als(alternating least square).
Here is the code.
user_item = df_no_duplicates.pivot(index='userId', columns='productId', values='rating').fillna(0)
print('Shape of User-Item sparse matrix:', user_item.shape)
user_item.head()
model1 = implicit.als.AlternatingLeastSquares(factors=20, regularization=0.1, iterations=20)
user_item_sparse1 = sparse.csr_matrix(user_item)
alpha_val = 40
data_conf = (item_user_sparse1 * alpha_val).astype('double')
model1.fit(data_conf)
model1.recommend(0,user_item_sparse1[0])
and i got the error index 945 is out of bounds for axis 1 with size 240 in method i found on github, if i use model1.recommend(0,user_item_sparse1) it will turn out to be user_items must contain 1 row for every user in userids
i checked the columns of the sparse matrix and the origin one they are exactly the same, so can anyone help me regarding this?
THANKS A LOT!
The text was updated successfully, but these errors were encountered: