Linear algebra is one of the most important topics in machine learning. In this article, I will introduce you to the basic concepts of linear algebra for machine learning using NumPy.

Machine learning and deep learning models depend on data. Their performance is highly dependent on the amount of data. So, we tend to collect as much data as possible to build a robust and accurate model. Data is collected in various formats, like numbers, images, text, sound waves, etc. However, we need to convert the data to numbers to analyze and model it.

**Also, Read – Machine Learning in Business Problems.**

It is not enough to convert the data to scalars (unique numbers). As the number of data increases, operations performed with scalars begin to be inefficient. We need to be vectorized or matrix operations to perform calculations efficiently. This is where linear algebra comes in.

Linear algebra is used for matrix multiplication, decompositions, determinants, and other square mathematical computations. In python Unlike some languages like MATLAB, multiplying two two-dimensional arrays with * is an element-by-element product instead of a matrix dot product. As such, there is a function point, both an array method and a function in the NumPy namespace, for matrix multiplication:

```
import numpy as np
x = np.array([[1., 2., 3.], [4., 5., 6.]])
y = np.array([[6., 23.], [-1, 7], [8, 9]])
print("X: ",x)
print("Y: ",y)
X: [[1\. 2\. 3.]
[4\. 5\. 6.]]
Y: [[ 6\. 23.]
[-1\. 7.]
[ 8\. 9.]]
```

A matrix product between a 2D array and a 1D array of appropriate size results in a 1D array:

```
x.dot(y) ## equivalently np.dot(x, y)
array([[ 28., 64.],
[ 67., 181.]])
np.dot(x, np.ones(3))
array([ 6., 15.])
```

🔵 Intellipaat Data Science with Python course: https://intellipaat.com/python-for-data-science-training/In this Data Science With Python Training video, you...

Applied Data Analysis in Python Machine learning and Data science, we will investigate the use of scikit-learn for machine learning to discover things about whatever data may come across your desk.

Practice your skills in Data Science with Python, by learning and then trying all these hands-on, interactive projects, that I have posted for you.