Interpret Linear Regression in 10 mins (Non-Technical) | by Anish Mahapatra | Towards Data Science

When there are so many great articles and interpretations of the most common algorithm out there, why take the effort to write this? How does an executive or a non-technical person interpret linear regression? All of the articles are heavy on the technicality.
I like to understand things for what they are minus the extra-effort.
Linear Regression is said to be the most basic algorithm that one can implement. Even though going through a tutorial on linear regression will enable even a high school student to understand and implement a model in Python in about five minutes, there are more nuances when applying machine learning algorithms in a production environment.
The agenda of this blog and the upcoming series is to capture and explain the subtleties of linear regression in layman terms (read non-technical). You can follow me here for more.
Do you remember the equation of a straight line that we learned in school? Mathematically, the representation of a straight line is represented as y = MX + b.
y = mx + bWhere, if you were to imagine a straight line (as shown above),m: The slope of the line (The angle at which the line is turned)b: The intercept (On the Y-Axis, how much higher or lower is the line)y: The dependent/ target variable (The value we want to predict)x: The independent/ predictor variable (The variable that we use to make the prediction)
Let us look at models from the lens of an executive, not a technically savvy person.
A machine learning model is simply a way to be able to represent or guess what is going to happen next, where something belongs or what combination of features will work best to know what is going to happen next.
A machine learning model is not magic. It is simply a mathematical best-fit representation of the data.
Linear in linear model stands for the straight line. The data has to be such that there is a linear trend in the data to be able to use linear regression. Let us look at one of the classic examples of a linear model — Newton’s first law of motion.
Force = Mass x Acceleration ( F = m x a )
Let us now interpret this. If the mass of the object is constant, then, as we increase the acceleration of an object, the force applied increases.
To compare this to the previous formula,
y = mx + bFor this case, y = mxand, there is no intercept: 'b' here. This means that the graph will pass through the origin. (when x = 0, y = 0)
Let us now look at what regression is in Linear Regression. In machine learning,
The dependent variable is represented as ‘y’
The independent variable(s) that will be used is/ are represented as ‘X’
Regression is simply establishing a relationship between the independent variables and the dependent variable. Linear regression is establishing a relationship between the features and dependent variable that can be best represented by a straight line.
Linear regression can be of two types: simple and multiple linear regression.- Simple Linear Regression: Using one independent variable to predict one dependent variable- Multiple Linear Regression: Using multiple independent variables to predict one dependent variable
So, if you have a data scientist that says:
I shall be running a multiple linear regression model on the independent features and the predictor, understand that he is going to try to make a straight line through the data where the line is close to as many input data points as possible.
A line can be drawn through the data in various ways.
Q. What do you think the best-fit line means? A. This is where you will hear the data scientists say that they are trying to minimize the cost function.
Q. What does the cost function/ error function mean?A. A function that sums up the errors. As a user, you would want an optimal cost function as this would mean that you have the least possible errors.
A best-fit line would have the tilt and intercept such that it passes through or as close to the data points as possible.
To be able to explain the simplicity and execution of models, you have to understand the implementation in depth. Feel free to leverage the same here on my Github. Do raise issues there or comment below if you are stuck anywhere through the flow of the machine learning notebooks. I strongly suggest you follow me here on Medium or LinkedIn to get maximum exposure to the bleeding edge in technology.
In case you would like to run the latest models on old hardware, you can refer to the link here to run it for free on the cloud.
https://towardsdatascience.com/running-jupyter-notebook-on-the-cloud-in-15-mins-azure-79b7797e4ef6
As a passive observer looking at various models that a data scientist is showing you, it is imperative that you are able to judge if a model is suitable for your needs. Notice how very delicately I have avoided using the word good or bad here. It is a conscious decision as it varies from case to case.
However, on that note, I have heard this too many times and am determined to provide you with use-cases and intuition, so that you can evaluate if the model is right for you. I shall stress here on pointers that an executive-level person can look at a Data Science Jupyter Notebook (code) or ask questions on, as mentioned below.
I shall explain the questions, but, not the answers as that is the role of the data scientist.
If the data scientist is not able to answer, the data scientist requires further training, before you decide to trust the results.
Did you clean the data? What are the steps you took for it and why? What are the columns that are affected?
By rows and columns, what is the percentage of missing values/ corrupted data? How did you handle the missing data?
Did you perform outlier analysis on the data? Can you show me the box-plots and explain them to me along with your reasoning as to why you decided to keep the outliers (or remove them)?
Show me the univariate plots and explain them to me in detail. Please make sure you explicitly document and mention the interesting trends.
Show me the bivariate plots and explain the interesting trends with respect to the dependent variable. Make sure you talk about the top correlated variables along with business backing. (Ask for heatmaps)
Has feature engineering been done on the data? What are the derived/ new features?
What is the test-train split? Why? Is there a spill-over in the train-test data?
How have you handled the categorical variables and generating gummy variables? Have you considered the dummy variable trap?
When plotting the models, variables should be dropped one by one and the statistics and VIF scores should be analyzed after every variable is dropped. Was this followed?
Have you considered the F-statistic or p-values (generally less than 0.05) for the statistics model?
Have you considered the possibility of multicollinearity? Can you please show me the VIF (Variable Inflation Factor)? (VIF >10 might indicate multicollinearity)
Have you validated the results on the test data? What is the R-Squared value? (The closer to 1, the better)
What is the adjusted R-Squared value? This can be used to compare models where there are a different number of features (The closer to 1, the better)
It’s admirable if you have got to this point. This means that you have a genuine interest and you deserve to understand the nuances of model-building. Provided we are dealing with mostly clean data, asking the above questions will help us interpret a linear regression model. To understand further on how to evaluate a linear regression model you can refer to the link here.
While the above questions may help you understand the work a data scientist has done, the best way to interpret Data Science is to simply do it yourself! Whether it’s code or interpretation of the same, the best way to gain an understanding, get your hands dirty and look through a few industry-standard implementations on Kaggle and ProjectPro.
www.linkedin.com
I spent a lot of time researching and thoroughly enjoyed writing this article. Show me some love if this helped you! 😄 I also write about the millennial lifestyle, consulting, chatbots and finance! If you have any questions or recommendations on this, please feel free to reach out to me on LinkedIn or follow me here, I’d love to hear your thoughts!