March 2020
Beginner to intermediate
352 pages
8h 40m
English
The next step is to extract the keywords from the title. There are several ways we can extract keywords. Here, we are going to use the TfidfVectorizer utility method provided by the sklearn.feature_extraction module. Let's get started:
from sklearn.feature_extraction.text import TfidfVectorizerfrom sklearn.cluster import MiniBatchKMeansfrom sklearn.decomposition import PCAfrom sklearn.manifold import TSNE
tfidf = TfidfVectorizer( min_df = 5, max_df = 0.95, max_features = 8000, stop_words = 'english')tfidf.fit(df.Title)text = tfidf.transform(df.Title)
Read now
Unlock full access