Created
March 19, 2021 09:45
-
-
Save cydal/f5c7b420a7e8cd3fa630e3b813ec5bde to your computer and use it in GitHub Desktop.
This file contains 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
from sknetwork.clustering import Louvain | |
## Tfidf vectorizer | |
tfidf_vectorizer_relevant = TfidfVectorizer(max_features=10000, ngram_range=(1,2)) | |
x_relevant_transformed = tfidf_vectorizer_relevant.fit_transform(df_core["abstract"]) | |
### Cosine Similarity | |
pairwise_similarity = x_relevant_transformed * x_relevant_transformed.T | |
louvain = Louvain() | |
labels = louvain.fit_transform(pairwise_similarity) | |
df_relevant["pred"] = labels |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment