Skip to content

Maybe your code exist some errors? #2

@MrRace

Description

@MrRace

Hi @khanhnamle1994
I have read your code in Content_Based_and_Collaborative_Filtering_Models.ipynb, I think there are some errors in them.
(1)when compute user_correlation,you use train_data directly. you can check the size of train_data,its column size is 3. Its correct size should equal to item size. The same problem when to compute item_correlation .
(2)In predict function,you wrote mean_user_rating = ratings.mean(axis=1), but the ratings variant is the whole rates which have not been groupby user_id.Therefor the mean_user_rating maybe wrong. You can also check the size or shape of mean_user_rating or ratings variant.
(3) I do not how the two kinds computational formulas come from.

pred = mean_user_rating[:, np.newaxis] + similarity.dot(ratings_diff) / np.array([np.abs(similarity).sum(axis=1)]).T

pred = ratings.dot(similarity) / np.array([np.abs(similarity).sum(axis=1)])

Could you please tell me some details of the formulas.
Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions