Recall & Review
beginner
What is a matrix in the context of data science?
A matrix is a rectangular grid of numbers arranged in rows and columns. It is used to organize data and perform mathematical operations like addition, multiplication, and finding determinants.
Click to reveal answer
beginner
How do you create a 3x3 matrix using SciPy?
You can create a 3x3 matrix using <code>scipy.sparse</code> or <code>numpy</code>. For example, with NumPy: <br><code>import numpy as np<br>matrix = np.array([[1,2,3],[4,5,6],[7,8,9]])</code>Click to reveal answer
intermediate
What is matrix multiplication and when is it used?
Matrix multiplication combines two matrices to produce a new matrix. It is used in data transformations, solving systems of equations, and machine learning algorithms.
Click to reveal answer
beginner
How can you find the transpose of a matrix in SciPy or NumPy?
The transpose flips a matrix over its diagonal. In NumPy, use
matrix.T. In SciPy sparse matrices, use matrix.transpose().Click to reveal answer
intermediate
What is the difference between dense and sparse matrices?
Dense matrices store all elements explicitly, even zeros. Sparse matrices store only non-zero elements to save memory and speed up calculations when many elements are zero.
Click to reveal answer
Which function creates a 2x2 identity matrix in NumPy?
✗ Incorrect
np.identity(2) creates a 2x2 identity matrix with ones on the diagonal and zeros elsewhere.
What is the result of multiplying a 2x3 matrix by a 3x2 matrix?
✗ Incorrect
Matrix multiplication of a 2x3 and 3x2 matrix results in a 2x2 matrix.
Which method transposes a sparse matrix in SciPy?
✗ Incorrect
In SciPy sparse matrices, use matrix.transpose() to get the transpose.
Why use sparse matrices instead of dense matrices?
✗ Incorrect
Sparse matrices save memory and speed up calculations by storing only non-zero elements.
Which library is commonly used for matrix operations in Python?
✗ Incorrect
NumPy is the main library for numerical and matrix operations in Python.
Explain how to create and multiply two matrices using SciPy or NumPy.
Think about how rows and columns must match for multiplication.
You got /3 concepts.
Describe the advantages of using sparse matrices in data science.
Consider when many matrix elements are zero.
You got /3 concepts.