Skip to content

Instantly share code, notes, and snippets.

@emmagrimaldi
Created September 30, 2018 23:55
Show Gist options
  • Select an option

  • Save emmagrimaldi/2c33e6faee9edab0da6fdc5505cc3559 to your computer and use it in GitHub Desktop.

Select an option

Save emmagrimaldi/2c33e6faee9edab0da6fdc5505cc3559 to your computer and use it in GitHub Desktop.
# instantiating and generating the count matrix
count = CountVectorizer()
count_matrix = count.fit_transform(df['bag_of_words'])
# generating the cosine similarity matrix
cosine_sim = cosine_similarity(count_matrix, count_matrix)
@manojjjm

Copy link
Copy Markdown

how did you created the bag of word model ! do we need to create a bag of word for data and add it as a new column

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment