Sklearn TruncatedSVD 不返回 n, 组件



我在TfIdf矩阵上拟合LSA模型。我的原始矩阵有

(20, 22096( 然后我应用截断SVD来执行LSI/缩减

svd = TruncatedSVD(n_components=200, random_state=42, n_iter=10) svdProfile = svd.fit_transform(profileLSAVectors) print(np.shape(svdProfile)) #result (20, 20)

而不是得到 (20,200( 我得到 (20, 20(

任何人都知道为什么....?

它是Scikit-learn中大多数分解过程中的"预期"行为。

我在 TruncatedSVD 的文档中找不到这一点,但您可以看到 PCA 的文档,其中提到:

n_components == min(n_samples, n_features)

您可以尝试将其发布在scikit-learn github问题页面上,以获得更清晰的信息。

最新更新