Skip to content

Instantly share code, notes, and snippets.

@RoaldSchuring
Created July 13, 2019 13:46
Show Gist options
  • Save RoaldSchuring/61c1a78fbbe0d7b41a8bb7620d8960d9 to your computer and use it in GitHub Desktop.
Save RoaldSchuring/61c1a78fbbe0d7b41a8bb7620d8960d9 to your computer and use it in GitHub Desktop.
retrieve_idf_weighted_word_embeddings
obj = client.get_object(Bucket='data-science-wine-reviews', Key='word_vectors_idf.csv')
wine_df = pd.read_csv(obj['Body'])
wine_df.set_index(['word'], inplace=True)
word_vectors = []
for p in payload:
word_vector_string = wine_df.at[p, 'word_vec_idf']
word_vector_string = word_vector_string.replace('[', '').replace(r'\n', '').replace(']', '')
word_vector = np.fromstring(word_vector_string, dtype=float, sep=' ')
word_vectors.append(word_vector)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment