Matrix Operations In Practice Using Python

amirsina torfi
Machine Learning Mindset
3 min readNov 25, 2019

--

Have you ever wondered why you need to know matrix operations? The answer is deadly simple: To work with matrices! Above all, I assume you already know the importance of linear algebra in Machine Learning and you are familiar with the basic definitions. Therefore, I do not need to talk about why it is important to know the matrix operations. Do I? In this tutorial, I will explain the most important matrix operations that we desperately need and frequently encounter in Machine Learning.

Here’s what you will learn here:

  • The core matrix operations such a matrix transpose, multiplication, and inversion.
  • For each of the operations, you will learn how to implement them in Python.
  • I will explain the properties of the explain operations.

The assumption is that you are somehow familiar with Python or you are in the process of learning. If you would like to learn Python the easy way, you can check my YouTube course online which is freely available for all. However, you do NOT need to know Python to understand the concepts presented in this article.

Matrix Transpose

Identity Matrix

Adding Operation

Scalar Multiplication

Matrix Multiplication

Vector-Matrix Multiplication

Matrix Inverse

Conclusion

In this tutorial, I explained the important matrix operations that are commonly used in Machine Learning. To understand the definitions better, you can refer to a previously published article, titled Basic Linear Algebra Definitions that You Hear Every Day. First I explain the specific operations. In addition, I showed you how to code it in Python. In conclusion, you made a sense of the practical implementation of the operations in Python in addition to their theoretical interpretation. Hopefully, you found them helpful to gain a better understanding of the concept.

You can find the original article here.

--

--