Python-从培训数据中删除稀疏性以进行培训

时间:2017-07-14 09:25:47

标签: python numpy sparse-matrix

我正在尝试使用张量流使用神经网络训练数据。问题在于我的训练数据---- X_train。当我在终端上写这个 -

>>> X_train

>>>*<5979149x1232279 sparse matrix of type '<type 'numpy.float64'>'
    with 24528898 stored elements in Compressed Sparse Row format>*

由于在训练神经网络时发生了错误。

Traceback (most recent call last):
  File "second.py", line 17, in <module>
    x = tf.placeholder('float', [None, len(X_train[0])])
  File "/usr/local/lib/python2.7/dist-packages/scipy/sparse/base.py", line 199, in __len__

>>>    raise TypeError("sparse matrix length is ambiguous; use getnnz()"
emphasized text 
***TypeError: sparse matrix length is ambiguous; use getnnz() or shape[0]***

任何人都可以帮我解决这个问题!!!!

0 个答案:

没有答案