Skip to content

Instantly share code, notes, and snippets.

@erap129
Last active May 5, 2022 18:43
Show Gist options
  • Save erap129/e1c8d06c8fb784992d38fd330664e631 to your computer and use it in GitHub Desktop.
Save erap129/e1c8d06c8fb784992d38fd330664e631 to your computer and use it in GitHub Desktop.
item_matrix_all_words_trainset_loocv = get_item_matrix_with_inner_ids(tfidf_matrix.todense(), movies_df, train_loocv)
cosine_sim_all_words_trainset_loocv = cosine_similarity(item_matrix_all_words_trainset_loocv,
item_matrix_all_words_trainset_loocv)
item_matrix_all_words_trainset = get_item_matrix_with_inner_ids(tfidf_matrix.todense(), movies_df, trainset)
cosine_sim_all_words_trainset = cosine_similarity(item_matrix_all_words_trainset, item_matrix_all_words_trainset)
get_algorithm_report(CustomSimKNNAlgorithm, trainset, testset, train_loocv, test_loocv, movies_df,
target_movie_id='movie_1', target_user_id='user_1', top_k=10,
algo_kwargs_trainset=dict(similarities=cosine_sim_all_words_trainset, sim_options={'user_based': False}),
algo_kwargs_trainset_loocv=dict(similarities=cosine_sim_all_words_trainset_loocv, sim_options={'user_based': False}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment