Matrix Algebra For Data Scientists
By: Farhad Malik
Tags: Machine Learning, Data Science, Fintech, Matrix, Mathematics

Matrix Algebra For Data Scientists

Understand The Building Stones Of The Machine Learning Algorithms

Most of the machine learning algorithms perform matrix algebra during training and predicting phases. This article will explain how matrix algebra works.

Matrix algebra is the pillar of machine learning algorithms

Why Should We Learn About Matrix Algebra?

Although data scientist languages such as Python can perform matrix algebra for you but I strongly recommend everyone to at least understand how matrix algebra works. It will help you understand the algorithms better and will increase the confidence in the machine learning algorithms.

Matrix Algebra Forms The Basis Of Machine Learning

Matrix algebra is used in a number of areas of machine learning field:

Regression algorithms rely on matrix algebra

Neural networks utilise matrix algebra

Classification algorithms compute matrix algebra

Optimisation and cost functions are based on matrix algebra

Dimension reduction algorithms heavily depend on the matrix algebra

Support vector machines, time series analysis and the entire deep learning is based on the matrix algebra concept

Let’s Start With Basic Concepts

Scalar

A scalar is a single number. It does not have a direction:

Vector

A vector has a direction and magnitude (size):

Vector is an array of scalar numbers.

Matrix

A matrix is a table of numbers. It has rows and columns.

Tensor

A tensor can be a scalar, a vector, a matrix or a matrix within a matrix. A tensor can contain multiple tensors. As an instance, a tensor can contain multiple matrices.

Matrix Transpose

This is the process where the rows and columns of a matrix are switched.

Let’s Look At Matrix Algebra

1. Matrix Addition

Matrix addition is simply achieved by taking each element of a matrix and adding it together as shown below:

2. Multiplying Scalar With A Matrix

Multiplying Matrix by a scalar is as straight forward as multiplying each element by the scalar:

3. Matrices Multiplication With Vector

Matrices multiplication is achieved by multiplying and then summing matching members of the two matrices. The image below illustrates how we can multiple a 3 by 3 and a 3 by 1 matrix together:

4. Matrices Multiplication With Matrix

To multiple a matrix by another matrix, perform the dot product. Essentially the key is to multiply the matching members:

Rule

N x M * M x O matrix = N x O matrix

Uses Of Matrix Algebra

For better understanding of practical use case of a matrix algebra, have a look at these two articles.

Some concepts live in the heart of data science. Eigenvectors and Eigenvalues are one of those concepts. This article will aim to explain what Eigenvectors and Eigenvalues are, how they are calculated and how we can use them.

2. The article belong explains the two most important components of a neural network. These two components are known as weights and bias. The weights are multiplied to the inputs via matrix multiplication to compute an output.

That’s all the Matrix Algebra Maths we need to know for the moment

Summary

This article explained how matrix algebra works. We understand that matrix algebra is one of the most important concepts that form the basis of the machine learning algorithms.

Matrix algebra is used nearly everywhere in Machine Learning.

Let me know if you have any feedback.

Hope it helps.