Sto riscontrando problemi nella memorizzazione di una nums csr_matrix con PyTables. Sto ottenendo questo errore:Memorizzare la matrice sparsa numpy in HDF5 (PyTables)
TypeError: objects of type ``csr_matrix`` are not supported in this context, sorry; supported objects are: NumPy array, record or scalar; homogeneous list or tuple, integer, float, complex or string
Il mio codice:
f = tables.openFile(path,'w')
atom = tables.Atom.from_dtype(self.count_vector.dtype)
ds = f.createCArray(f.root, 'count', atom, self.count_vector.shape)
ds[:] = self.count_vector
f.close()
Tutte le idee?
Grazie
Sei preoccupato per la dimensione dei dati sul disco? Penso che i file hdf5 possano essere archiviati in formato compresso, nel qual caso potresti farla franca semplicemente memorizzando la matrice densa. – user545424
Vedere http://stackoverflow.com/questions/8895120/using-pytables-which-is-more-efficient-scipy-sparse-or-numpy-dense-matrix, sembra che non vi sia alcun supporto pytables per matrici sparse. – user545424