Linear Regression Model for Machine Learning

Linear Regression Model for Machine Learning

An overview of the oldest supervised machine-learning algorithm, its type & shortcomings.

Image for post

Photo by Scott Webb from Pexels

Linear Regression is one of the fundamental supervised-machine learning algorithm. While it is relatively simple and might not seem fancy enough when compared to other Machine Learning algorithms, it remains widely used across various domains such as Biology, Social Sciences, Finance, Marketing. It is extremely powerful and can be used to forecast trends or generate insights.Thus, I simply cannot emphasize enough how important it is to know Linear Regression — its working and variants — inside out before moving on to more complicated ML techniques.


Linear Regression Models are extremely powerful and can be used to forecast trends & generate insights.


The objective of the article is to provide a comprehensive overview of linear regression model. It will serve as an excellent guide for last-minute revisions or to develop a mindmap for studying Linear Regression in detail.

Note: Throughout this article, we will work with the popular Boston Housing Dataset which can be imported directly in Python using sklearn.datasets or in R using the library MASS(Modern Applied Statistics Functions). The code chunks are written in R.

What is Linear Regression?

Linear Regression is a statistical/machine learning technique that attempts to model the linear relationship between the independent predictor variables X and a dependent quantitative response variable Y. It is important that the predictor and response variables be numerical values. A general linear regression model can be represented mathematically as

Image for post

Linear Regression Model Equation; Image by Author

Since the linear regression model** approximates** the relationship between Y and X, by capturing the irreducible error term we get

Image for post

Linear Regression Model Equation with Approximation; Image by Author

Here, we will use Linear Regression to predict Median House Value (Y/response variable = medv)for 506 neighborhoods around Boston.

What insights does Linear Regression reveal?

Using Linear Regression to predict median house values will help answer the following five questions:

  1. Is there a linear relationship between the predictor & response variables?
  2. Is there an association between the predictor & response variables? How strong?
  3. How does each predictor variable effect the response variable?
  4. How accurate is the prediction of response variable?
  5. Is there any interaction among the independent variable?

machine-learning data-science data-science-interview linear-regression towards-data-science

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Linear Regression For Data Science

Linear regression is commonly used to quantify the relationship between two or more variables. It is also used to adjust for confounding.

15 Machine Learning and Data Science Project Ideas with Datasets

Learning is a new fun in the field of Machine Learning and Data Science. In this article, we’ll be discussing 15 machine learning and data science projects.

Towards Machine Learning — Linear Regression and Polynomial Regression

I decided to write few brief articles regarding this topic, which are intended to help people new to this topic dive in the interesting world of Machine Learning. Today we go further, and tackle Linear Regression, another extremely popular and wide used technique.

Most popular Data Science and Machine Learning courses — July 2020

Most popular Data Science and Machine Learning courses — August 2020. This list was last updated in August 2020 — and will be updated regularly so as to keep it relevant

Data Science Interviews: Machine Learning

A technical guide on machine learning and 20 challenging problems to look over. This post will provide a technical guide on machine learning theory within data science interviews. It is by no means comprehensive but aims to highlight key technical points within each topic. The problems discussed are from this data science interview newsletter which features questions from top tech companies and will be involved in an upcoming book.