私は scipy 疎行列 (csr:Compressed Sparse Row matrix) を持っています。Orange の機能選択メソッド (Orange.feature.scoring.score_all (InfoGain/MDL)) を使用したいと思います。ただし、私の理解では、numpy 配列のみを引数として受け入れるテーブルを作成する必要があります。したがって、(.toarray()) を使用して csr マトリックスを配列に変換しようとすると、次のエラーが発生します (マトリックスのサイズのため)。
Traceback (most recent call last):
File "C:\Users\NMS\Desktop\PyExp\experiments_acl2013.py", line 249, in <module>
print(X_train.toarray())
File "C:\Python27\lib\site-packages\scipy\sparse\compressed.py", line 561, in toarray
return self.tocoo(copy=False).toarray(order=order, out=out)
File "C:\Python27\lib\site-packages\scipy\sparse\coo.py", line 238, in toarray
B = self._process_toarray_args(order, out)
File "C:\Python27\lib\site-packages\scipy\sparse\base.py", line 635, in _process_toarray_args
return np.zeros(self.shape, dtype=self.dtype, order=order)
ValueError: array is too big.
スパース行列を渡してテーブルを作成できる別の方法はありますか? または、疎行列を直接使用してテーブルを作成せずに、Orange で InfoGain または MDL を適用する方法はありますか?
memmap を Table に渡すと、次のエラーが発生します。
>>> t2 = Table(d2, mm)
Traceback (most recent call last):
File "<pyshell#125>", line 1, in <module>
t2 = Table(d2, mm)
TypeError: invalid arguments
ドメインなしで memmap を渡すと、次のようになります。
>>> mm
memmap([[0, 1, 2, 4],
[9, 8, 6, 3]])
>>> t2 = Table(mm)
Traceback (most recent call last):
File "<pyshell#128>", line 1, in <module>
t2 = Table(mm)
TypeError: invalid arguments for constructor (domain or examples or both expected)