Sparse matrices in Python are of great of use when you work with dataset that are of high dimensional and sparse. Python’s Scipy has a set of tools to work with different types of commonly used sparse matrices. In this post, we will learn how to save a sparse matrix in Mtx format and npz […]
Sparse Matrix in Python
How To Slice Rows and Columns of Sparse Matrix in Python?
Sometimes, while working with large sparse matrices in Python, you might want to select certain rows of sparse matrix or certain columns of sparse matrix. As we saw earlier, there are many types of sparse matrices available in SciPy in Python. Each of the sparse matrix type is optimized for specific operations. We will see […]
How To Visualize Sparse Matrix in Python?
When you work with sparse matrix data structure with SciPy in Python, sometimes you might want to visualize the sparse matrix. A quick visualization can reveal the pattern in the sparse matrix and can tell how “sparse” the matrix is. And it is a great sanity check. One way to visualize sparse matrix is to […]
How To Create Random Sparse Matrix of Specific Density?
Sometimes, you may want to create sparse random matrices with specific shape and sparsity for testing out a new method or algorithm. Scipy’s sparse module has very useful functionalities that are of great use to create sparse matrices of specific density and from specific probability distributions. Let us see some simple examples of create random […]
3 Ways To Create Sparse Matrix in COO Format with SciPy
Sparse matrices greatly help dealing with large matrices with a lot of missing data. Sparse matrix efficiently store data set with a lot sparsity in matrix. It offers a much smaller memory foot print to store and access than the full matrix. With SciPy’s Sparse module, one can directly use sparse matrix for common arithmetic […]