What does "Sparseness" mean?
Sparseness can refer to either the content of a matrix or the representation.
What is a dense and what a sparse matrix in terms of content?
What is the level of sparsity/density? How can its value be interpreted?
The level of sparsity or density is an indication of how sparse or dense a matrix is. It can be computed by dividing the number of non-zero elements by the total number of elements.
What is a sparse represenation of a matrix?
Give an example of a sparse matrix.
What are the benefits of a sparse representation of a matrix?
When do we use sparse matrix representations in data science?
When working with
How can sparse matrices be stored using Scipy in Python?
There are several ways to store sparse matrices in Scipy. Unfortunately there is no "one" sparse matrix representation that can do all tasks efficiently and fast. There are two groups that specialize in doing one thing really well:
Which three formats were discussed in detail in the lecture?
How is a sparse matrix represented when using csr?
CSR represents the matrix with three numpy arrays. They contain:
csr_m = scipy.sparse.csr_matrix(dense_matrix, shape = dense_matrix.shape)
What are advantages and disadvantages of the csr representation?
Advantages:
Disadvantages:
How is a sparse matrix represented when using csc?
CSC represents the matrix with three numpy arrays. They contain:
csc_m = scipy.sparse.matrix_csc(dense_matrix, shape = dense_matrix.shape)
What are advantages and disadvantages of the csc representation?
Advantages:
Disadvantages:
How is a sparse matrix represented when using dok (dictionary of keys)?
Dictionary of keys (dok) is a dictionary format where
S = scipy.sparse.matrix_dok((5,5), dtype = numpy.int32)
How does a DOK differ from dictionaries in vanilla python?
We can build sparse matrix representation through converting from dense matrices or building incrementally. But can we also create sparse matrix represenations from random numbers through functions?
Yes, we can! There are three functions we discussed:
Each of these functions can be passed a parameter format to indicate which representational format to create.
What if you have a doc-matrix and want to find index of the max/min of each ROW?
Convert the dok-matrix to a CSR matrix and use argmin()/argmax()
What if you have a doc-matrix and want to find index of the max/min of each COLUMN?
Convert the dok-matrix to a CSC matrix and use argmin()/argmax()