my_csr_matrix
类型为“”的<;338232x1783504稀疏矩阵 以压缩稀疏列格式存储1574056个元素>
my_csr_matrix[:,736225:1783504] = 0
Traceback (most recent call last):
File "C:\Users\abhatia\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2862, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-135-b0e125d5d27e>", line 1, in <module>
my_csr_matrix[:,736225:1783504] = 0
File "C:\Users\abhatia\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\sparse\compressed.py", line 695, in __setitem__
i, j = self._swap((i.ravel(), j.ravel()))
MemoryError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\abhatia\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2802, in run_ast_nodes
if self.run_code(code, result):
File "C:\Users\abhatia\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2879, in run_code
self.showtraceback(running_compiled_code=True)
TypeError: showtraceback() got an unexpected keyword argument 'running_compiled_code'
设置这些元素会添加一堆
non-zero
元素(即使值为0)。此赋值不区分设置为0和设置为其他值。你知道吗我们用一个单独的步骤删除0
乘以0不会添加新值;它只会更改现有值:
这应该可以避免大矩阵中的内存错误。你知道吗
这些列上的矩阵积可能更快—尽管它生成了一个新的矩阵。你知道吗
相关问题 更多 >
编程相关推荐