Created
July 14, 2020 08:36
-
-
Save risenW/bb359ae0b35cfbf5e6481e9b243efd02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b_id =list(ratings_df.book_id.unique()) | |
b_id.remove(10000) | |
dict_map = {} | |
for i in b_id: | |
dict_map[i] = books_df_copy.iloc[i]['title'] | |
out_v = open('vecs.tsv', 'w') | |
out_m = open('meta.tsv', 'w') | |
for i in b_id: | |
book = dict_map[i] | |
embeddings = book_em_weights[i] | |
out_m.write(book + "\n") | |
out_v.write('\t'.join([str(x) for x in embeddings]) + "\n") | |
out_v.close() | |
out_m.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment