Introduction to Linear Algebra¶
What is Linear Algebra?¶
Linear algebra is the branch of mathematics concerning linear equations such as linear maps such as and their representations in vector spaces and through matrices. Linear algebra is central to almost all areas of mathematics See More
Applications of Linear Algebra in Data Science¶
Loss Functions
Regularization
Covariance Matrix
Support Vector Machine Classification
Principal Component Analysis (PCA)
Singular Value Decomposition
Word Embeddings
Latent Semantic Analysis (LSA)
Image Representation as Tensors
Convolution and Image Processing
SEE DETAILS: https://www.analyticsvidhya.com/blog/2019/07/10-applications-linear-algebra-data-science/
Linear Algebra Operations¶
# import numpy
import numpy as np
Determinant of matrix¶
The determinant of a matrix is a special number that can be calculated from a square matrix \begin{equation} A = \begin{bmatrix} a & b \ c & d \end{bmatrix} \ det(A) = ad - bc \end{equation} Whre, A is a \(2 \times 2\) matrix.
np.linalg.det()
- performs determinant of the matrixSyntax:
np.linalg.det(matrix)
Source: https://www.mathsisfun.com/algebra/matrix-determinant.html
A = np.arange(0, 16).reshape(4,4)
print(A)
[[ 0 1 2 3]
[ 4 5 6 7]
[ 8 9 10 11]
[12 13 14 15]]
# determinant of A
np.linalg.det(A)
-2.9582283945787796e-30
B = np.matrix("4,5,6,7;2,-3,3,3; 3,4,5,6; 4, 7,8,9")
# determinant of B
np.linalg.det(B)
12.000000000000005
Rank of matrix¶
np.linalg.matrix_rank()
- returns rank of the matrixSyntax:
np.linalg.matrix_rank(matrix)
# rank
np.linalg.matrix_rank(A)
2
### Rank of matrix
- `np.linalg.matrix_rank()` - returns rank of the matrix
- **Syntax:** `np.linalg.matrix_rank(matrix)`
References¶
https://numpy.org/
https://www.edureka.co/blog/python-numpy-tutorial/
https://github.com/enthought/Numpy-Tutorial-SciPyConf-2019
This notebook was created by Jubayer Hossain | Copyright © 2020, Jubayer Hossain