Truncated singular value decomposition reduces a large matrix to its most useful dimensions. For text analysis, it projects sparse TF–IDF or bag-of-words document vectors into a smaller document-topic space, preserving broad patterns while discarding less important dimensions. section 4.3.2
Choose p dimensions rather than retaining the full decomposition. This is especially practical for sparse natural-language matrices, where most entries are zero and randomized methods can compute an approximate decomposition efficiently. section 4.3.2 section 4.4.2
Project TF–IDF documents into topics
from sklearn.decomposition import TruncatedSVD svd = TruncatedSVD(n_components=16, n_iter=100) svd_topic_vectors = svd.fit_transform(tfidf_docs) The resulting matrix represents documents with 16 topic coordinates instead of thousands of term-frequency coordinates. The returned fit-transform result is U · S, while svd.components_ contains V, whose word weights help inspect the topics. section 4.4.1
Inspect component weights alongside the vocabulary to identify which words contribute to each topic. Interpretation still depends on data preparation: noisy vocabulary terms can make topics difficult to understand. section 4.4.1
Unlike PCA, TruncatedSVD does not center the input before decomposition. Centering can turn a sparse matrix dense, increasing runtime and memory, so TruncatedSVD is generally better suited to sparse TF–IDF data. section 4.4.2
