A model widely used in traditional statistics is the linear regression model. In this article, the objective is to follow the step-by-step implementation of this type of models using Tensor Flow. We are going to represent a simple linear regression.
For our study, we will analyze the age of the children on the x axis and the height of the children on the y axis.
We will try to predict the height of the children, using their age, applying simple linear regression.
The regression model will be represented in Tensor Flow. We will try to train the model to find the best W and b. Academic source of this example link.
We will use a spreadsheet to explore the results in a traditional way:
Now, what do we look for with this model of ML?, Recalling our linear function y = Wx + b
One of the goals is to learn, to find the best W and b.
The best values for W and b will reduce the cost. As shown in the following figure.
With the lowest cost, we radically improve the prediction, as shown in the following figure:
Let’s develop the model in Tensor Flow. *If you need to see the implementation code, you can see them in detail in stackoverflow documentation. [Best display for code and comments]
I also included Tensor Board in our study to analyze the model:
And the tracing of the cost function:
If we compare our study using a traditional template and our automatic model, it is evident that we have better accuracy and also the whole scale to ingest a greater volume of data. Are you ready for more magic?
Version of the article in Spanish here.