在CountVectorizer变为(40,845 X 218,904)(unigram)之后,我只有2个类和训练数据集矩阵大小的文档分类问题.在考虑三卦的情况下,它可达到(40845 X 3,931,789).有没有办法在这样的数据集上执行PCA而不会获得内存或稀疏数据集错误.我在6GB机器上使用python sklearn.
我有一个非常大的Scipy稀疏(csr)矩阵.我无法使用,M.toarray()因为它触发ValueError: array is too big.是否有一种方法可以在Python中保存Scipy稀疏矩阵以便在Matlab中读取?我需要Matlab中提供的一些工具.
我有一个矩阵,命名X_test,从产生的sklearn.feature_extraction.text.CountVectorizer.当我执行以下功能时:
import numpy as np
np.set_printoptions(threshold='nan')
print(X_test.shape)
print(X_test.size)
print(X_test.ndim)
print(np.array(X_test))
Run Code Online (Sandbox Code Playgroud)
我明白了:
(10211, 218904)
477881
2
(0, 934) 14
(0, 6773) 1
(0, 11035) 1
(0, 22362) 1
(0, 23619) 1
(0, 24812) 1
(0, 25224) 1
: :
(0, 64428) 1
(0, 66506) 1
Run Code Online (Sandbox Code Playgroud)
我不知道为什么尺寸不是矩阵尺寸(形状)的乘积.