As you’ve noticed, you can’t. But the notes on dok_matrix
say:
Can be efficiently converted to a coo_matrix once constructed.
and coo_matrix
does support saving with scipy.sparse.save_npz
. So I would suggest converting with .tocoo()
and then saving. You can convert back after loading (if you wish).
CLICK HERE to find out more related problems solutions.