January 2019
Intermediate to advanced
294 pages
6h 43m
English
The following are the steps for executing TF-IDF in Python:
from sklearn.feature_extraction.text import TfidfVectorizer
corpus = ['First document', 'Second document','Third document','First and second document' ]
vectorizer = TfidfVectorizer()
X = vectorizer.fit_transform(corpus)print(vectorizer.get_feature_names())print(X.shape)
The output is as follows:
![]()
X.toarray() ...
Read now
Unlock full access