python - how to check if matrix is sparse or not
scipy.sparse.issparse(my_matrix)
You can do sparsity = 1.0 - count_nonzero(X) / X.size
This works for any matrices.
scipy.sparse.issparse(my_matrix)
You can do sparsity = 1.0 - count_nonzero(X) / X.size
This works for any matrices.