Linear regression
As we mentioned earlier, regression is a technique for predicting continuous values based on certain inputs or variables. With linear regression, we try to learn from data that can fit into a straight linear line. For example, we can try to predict the amount in sales of a product based on variables such as amount spent on advertising, number of hits received on the e-commerce website, price of the product, and percentage offered in terms of sale price. To explain linear regression let's use a simple example using a sample fictitious data of the count of likes on a Facebook post versus the number of times it was shared, as shown in the following table:
Let's try to plot this data on a line chart:
As you can see in the preceding figure, the data points are linear, which means that they linearly go up. In other words, an independent variable count of likes, when changed causes the value of a dependent variable that is number of shares to change. Thus, if we know a future value...