The two-dimensional array with rows and columns is called a matrix. It represents real value at each location, and the location can be denoted as a variable. 'i', 'j'. Here 'i' indicates rows and 'j' indicates columns.
Each matrix comes with dimensions n x m, 'n' for number of rows and 'm' for number of columns.
The above matrix shows a, b, c, and d are elements can be any real number of the matrix; each element has a unique address, and the address indicates with variables i and j as discussed above.
number of rows (n) = 2 and number of columns (m) = 2
A[i][j] = A[0][0] = a; first row and first column.
A[i][j] = A[0][1] = b; first row and second column.
A[i][j] = A[1][0] = c; second row, first column.
A[i][j] = A[1][1] = c; second row, second column.
We understood what a matrix is; now it's time to see why a matrix is there. Let's dive into it.
Think about a scenario where you have an Excel sheet with salaries and the number of leaves mentioned in it. Let's suppose your manager told you to add 1000 extra salaries for each of them by reducing the number of leaves by 1 for each of them.
Definitely, you will do it just by an excel formula = SUM(col, val)
Here the action you performed is called matrix addition; it seems very simple; wait, this is not enough about matrix.
So a matrix is to apply mathematical operations to two-dimensional data.
I found an awesome article that guides you to understand arithmetic operations and some information about vectors as well.
https://www.geeksforgeeks.org/matrices-and-matrix-arithmetic-for-machine-learning/
Note: Before proceeding, I recommend you go through the above article, which prepares you for upcoming advanced topics.
Machine learning is a tool to deal with data to learn from it and produce future trends and outcomes. There is only one way to deal with massive data, and this is a matrix.
Topics Covered
Transpose of matrix
Inverse of matrix
Determinant of matrix
Eigenvectors and Eigenvalues of matrix
You will learn these topics with an application-oriented mindset without further delay. Let's get started.
The transpose of a matrix is nothing but altering rows into columns and columns into rows.
A[i][j] = A[j][i]
Data Science and Machine Learning: Transposing matrices helps in performing operations like covariance calculation, where you need to align data vectors for computation.
Computer graphics: The transpose is crucial in transforming coordinates, such as rotating or scaling objects in 3D space.
An Indian corporate team is working to build a deep learning model for level of pollution prediction through satellite images. And for this project, they scrapped images from the internet. Let's assume this scenario.
But unfortunately, they didn't collect enough images to train a better CNN (Convolutional Neural Network).
Now guess how to solve this issue?
Exactly by transpose matrix, an image is nothing but a multidimensional array with pixel values in it, right? In this case, matrix transpose will rotate the image by a 90° angle and create another image. This process of generating images by using referring available images is called the Data Augmentation technique.
In Machine Learning it's common to work with matrix and vector, especially finding weights, which is the key concept. So let's understand it with one example.
y = X * w
where:
y is dependent variable
X is independent variable
w is weights of vector
Let's learn it through one example below, Keep in mind we have y value and X value; our goal is to find out w
In three-dimensional space, think about a cube with coordinates (0,0,0), (0,0,1), (0,1,0), and (1,0,0).
The original cube in 3D space has the following coordinates for its vertices:
X Y Z
0 0 0
0 0 1
0 1 0
1 0 0
The cube is stretched along the y-axis by 1 additional unit. This means the new coordinates are:
X Y Z
0 0 0
0 0 1
0 2 0 (changed)
1 0 0
How much new volume is a multiple of the previous cube?
Obviously, the new volume is 2 cubic units bigger than the previous one, right?
Let's prove it with determinant:
The transformation matrix T is designed to:
Leave x-axis and z-axis values unchanged (1 on the diagonal for x and z).
Scale the y-axis by 2 (placing 2 in the middle of the diagonal to stretch the y-values).
Thus, the transformation matrix becomes:
So, to determine the change in volume, we need all the stretched vectors (eigenvectors) and the amount by which each vector is stretched (eigenvalues).
Two concepts arise here:
Eigenvectors
Eigenvalues
The vectors that get stretched during transformation of any volume without changing the direction are called Eigenvectors
The unit by which the vector gets stretched is called Eigenvalues.
In summary, matrices are powerful tools for handling and manipulating multidimensional data, making them essential in various fields such as Machine Learning, Data Science, and Computer Graphics.
Throughout this article, we explored key concepts, including the transpose, inverse, determinant, and eigenvectors and eigenvalues of matrices.
These fundamental operations enable us to perform transformations, solve equations, and understand changes in space, such as volume transformations. They also play a crucial role in tasks like data augmentation in deep learning and in building predictive models by calculating key parameters such as weights.
There are no models linked
There are no models linked
There are no datasets linked
There are no datasets linked