【发布时间】:2016-09-08 14:47:25
【问题描述】:
我已经处理了 CSV 文件中的文档数据,我在 pandas DataFrame 中读取:
+----------+------+------------+
| document | term | count |
+----------+------+------------+
| 1 | 126 | 1 |
| 1 | 80 | 1 |
| 1 | 1221 | 2 |
| 2 | 2332 | 1 |
所以它由document_id、term和term频率组成。
我没有原始文档,只有这个处理过的数据,我想用 sklearn 应用 SVD,但我不知道如何为 SVD fit_transform() 准备这个 DataFrame,它期望:
X : {array-like, sparse matrix}, shape (n_samples, n_features)
【问题讨论】:
标签: python scikit-learn nlp svd dimensionality-reduction