I am trying to build my deep learning model using Keras and TensorFlow. My model needs to input a matrix as the features.
The matrix is too big to be fitted into the memory. Fortunately, however, the matrix is very sparse. So I use scipy.sparse.dok_matrix()
to store it.
The problem is Keras doesn't support a sparse matrix as the input(maybe TensorFlow does?). I searched on internet and found some solutions to this problem, just like this one: Keras, sparse matrix issue. It used a .todense()
function to turn the sparse matrix to a dense one.
But these are stupid solutions. They are actually 'fake solutions', because if I could put a dense matrix into memory, why would I use a sparse one?
So anyone has 'real solutions' to this problem?