Linear regression may be one of the most important algorithms in statistics, machine learning, and science in general. It’s one of the most used algorithms and it is very important to understand how to implement it and its various flavours. One of the advantages that linear regression has over many other algorithms is that it is very interpretable.

Using the Matrix Inverse Method

we will use TensorFlow to solve two-dimensional linear regressions with the

matrix inverse method.

Getting ready

Linear regression can be represented as a set of matrix equations, say Ax =B. Here we are interested in solving the coefficients in matrix x. We have to be careful if our observation matrix (design matrix) A is not square. The solution to solving x can be expressed as

Image for post

To show this is indeed the case, we will generate two-dimensional data,

solve it in TensorFlow, and plot the result.

#data-science #artificial-intelligence #machine-learning #tensorflow

Linear regression with TensorFlow
4.45 GEEK