Linear Regression Explained!

Linear Regression Explained!

In my last post, I shared a list of questions asked in the Microsoft interview for the Data & Applied Scientist role. As promised, here is the answer to the first one which was 'Explain Linear Regression.' This is my approach to the problem:?

Linear Regression: To explain Linear Regression, one must explain Regression. So, Regression is a statistical technique that is used to measure the strength & character of the relationship between dependent & independent variables. When this relationship can be modeled using a Linear Function then it is known as Linear Regression.?

Let us understand this with the help of an example, let's say you go to a sports club where the fee is ?100 then your total cost becomes 100 * x where x is the number of times you visit the club. Now, let's say the club owner offers you a membership option where you have to pay an additional ?50 & become a member. After becoming a member you get a discount of 30% on the daily fees. So, now the total cost becomes 100(1 - 0.3)x + 50. I can represent this in the form of a Linear Equation?

total_cost = 70 * (total_number_of_visits) + 50

Now, as you can see I can model the above situation using a Linear Function which is of the form y = m * x + c.?

We can use Linear Regression to model the relationship between 2 or more variables (dependent & independent) by fitting a Linear Function. The parameters m & c (in y = m * x + c) define the strength & character of the relationship between dependent & independent variables & these parameters are what we try to estimate using Linear Regression.

Another example:?Let's say you want to understand/model the relationship between the happiness of the country & the GDP of the country (with the initial hypothesis being that countries with higher GDP are happier than those with lower GDP). We can model the relationship between the happiness_index & the GDP of the country using the equation given below,

happiness_index = θ1 * GDP + θ0

We can use Linear Regression in this setting to estimate the ideal values for θ0 & θ1 which will help us model the relationship between these 2 variables.

You can also check out this amazing explanation by Josh Stammer in one of his videos.

Here are some follow-up questions that you can expect:?

1. What is a cost function? What are some of the cost functions that you can use to train your Linear Regression Model?

2. What is the difference between correlation & regression?

3. Explain Gradient Descent Algorithm.

4.?Is there any other way to solve linear regression without gradient descent?

You can also check out some of my blogs to learn more about Linear Regression.

Conclusion

I hope you found this blog post insightful. Please do share it with your friends & family. You can reach out to me on?LinkedIn. I am quite active here & I will be happy to have a conversation with you. Please feel free to drop your feedback in the comments that helps me to improve the quality of my work. I will keep on sharing more content as I grow & mature as a Data Scientist. Until next time,?Keep Hustling & Keep Up with Data Science. Happy Learning?:)

Follow?Chitwan Manchanda?for more!

Chitwan Manchanda

ML @ Turing.com (Core Team) | DSML TA at Scaler Academy | Ex-EditorialistYX | Ex-Delhivery | Ex-Goals 101 | 2X Kaggle Expert

2 年

I hope you find my post informative. I'm open to more such conversations about (but not limited to) - data science & analytics, machine learning, and artificial intelligence. Book a slot with me today through the link provided.?Thanks. https://lnkd.in/duBjHrWF

要查看或添加评论,请登录

社区洞察

其他会员也浏览了