regression in machine learning

Regression in Machine Learning: Types & Examples

Machine Learning has become a fundamental part of people’s lives and it typically holds two segments. It includes supervised and unsupervised learning. Supervised Learning deals with labels data and unsupervised learning deals with unlabelled data. 

Supervised learning can be classified into classification and regression where regression deals with continuous values and the former deals with discrete values. The following blog revolves around Regression in Machine Learning and its types. 

What is Regression in ML? 

Regression Machine Learning algorithms is a statistical method that you can use to model the relationship between dependent variables and one or more independent variables. The analysis helps you in understanding the change in the value of the target variable corresponding to an independent variable. 

It is possible when the other independent variables are held at a fixed place. There are different types of regression in Machine Learning Regression algorithms where the target variable with continuous values and independent variables show linear pr non-linear relationship. 

Effectively, regression algorithms helps in determining the best-fit line. It passes through all data points in a way that the distance of the line from each data point is minimum.

15 Types of Regression Models & when to use them:

Regression algorithms models are statistical techniques used to model the relationship between one or more independent variables (predictors) and a dependent variable (response). There are various types of regression models ML, each designed for specific scenarios and data types. Here are 15 types of regression models and when to use them:

1. Linear Regression: 

Linear regression is used when the relationship between the dependent variable and the independent variables is assumed to be linear. It is suitable for continuous numerical data and when the response variable can be predicted using a straight line.

Linear regression is a fundamental and widely used statistical method for modeling the relationship between a dependent variable (Y) and one or more independent variables (X). 

It assumes a linear relationship between the predictor(s) and the response variable. Mathematically, a simple linear regression can be expressed as: Y = β0 + β1*X + ε, where β0 and β1 are the coefficients, and ε represents the error term.

Linear Regression

Example: Suppose we want to predict house prices (Y) based on the size of the house (X). We collect data on various houses with their respective sizes and their actual selling prices. The goal is to fit a straight line that best describes the relationship between house size and price.

2. Multiple Linear Regression: 

Similar to linear regression, but it involves multiple independent variables. It is used when the response variable depends on more than one predictor variable.

Multiple linear regression extends the concept of simple linear regression to include more than one independent variable. The model becomes: Y = β0 + β1X1 + β2X2 + … + βn*Xn + ε, where n is the number of predictors.

Multiple Linear Regression

Example: Building on the house price prediction example, we can include additional features such as the number of bedrooms, location, and age of the house. The multiple linear regression model will help us understand how each predictor contributes to the overall price prediction.

3. Polynomial Regression: 

Polynomial regression is used when the relationship between the dependent and independent variables can be better approximated by a polynomial function rather than a straight line. It is suitable when data follows a curvilinear pattern.

Sometimes, the relationship between the predictors and the response variable may not be linear. Polynomial regression allows us to capture more complex patterns by using polynomial functions of the predictors (X). The model can be expressed as: Y = β0 + β1X + β2X^2 + … + βn*X^n + ε.

Polynomial Regression

Example: Consider the temperature and gas consumption example. If gas consumption increases with temperature in a nonlinear manner, polynomial regression can help us model this relationship more accurately.

4. Ridge Regression (L2 Regularization): 

Ridge regression is used to handle multicollinearity (high correlation between predictors) in multiple linear regression. It adds a penalty term to the least squares objective function to stabilize the model.

Ridge regression is a regularized form of linear regression that addresses multicollinearity issues (high correlation between predictors). It adds a penalty term (L2 norm) to the least squares objective function, which prevents large coefficient values. This regularization helps to stabilize the model and reduces overfitting.

Example: In a sales prediction scenario, advertising expenses and promotion budgets might be highly correlated. Ridge regression can be used to prevent overemphasizing one of these variables and achieve a more robust model.

5. Lasso Regression (L1 Regularization): 

Lasso regression is used when you want to perform feature selection along with regression. It adds an absolute value penalty term to the least squares objective function, forcing some coefficients to become exactly zero.

Lasso regression is another regularization technique that can be used for feature selection along with regression. It adds an absolute value penalty term (L1 norm) to the least squares objective function. This causes some coefficients to become exactly zero, effectively performing variable selection.

Example: In a medical study, we have several potential predictors for predicting the occurrence of a disease. Lasso regression can help identify the most relevant predictors and eliminate the less important ones.

6. Decision Tree Regression: 

Decision tree regression is a non-parametric Machine Learning technique used for predicting continuous values. It constructs a tree-like structure by recursively splitting the data based on feature values, creating branches and leaf nodes. 

Each leaf node represents a predicted value for the target variable. The algorithm is simple to interpret and can capture complex relationships in the data.

Decision Tree Regression

Example: Suppose we have a dataset containing information about houses, including their size, number of bedrooms, and sale prices. We want to use decision tree regression to predict the price of a new house based on its features.

The decision tree algorithm analyzes the data and creates a tree structure. It might first split the data based on the size of the house. If the house is smaller than a certain threshold, it goes to the left branch, and if it’s larger, it goes to the right branch. Then, it further splits the data based on the number of bedrooms.

Read Blog: A tale of regression and regressiveness

7. Logistic Regression: 

Logistic regression is used for binary classification problems where the response variable is binary (e.g., yes/no, true/false). It models the probability of the binary outcome. The model transforms a linear combination of predictors using a logistic (sigmoid) function to estimate the probability of the binary outcome.

Logistic Regression

Example: In email spam classification, logistic regression can predict the probability that an email is spam based on various features of the email.

8. Poisson Regression: 

Poisson regression is used when the dependent variable represents count data (e.g., number of occurrences) and follows a Poisson distribution.

Poisson Regression

Example: Modeling the number of customer service calls a company receives in a day based on factors like day of the week, advertising campaigns, or seasonal effects.

9. Negative Binomial Regression: 

Negative binomial regression is an extension of Poisson regression used when there is overdispersion in count data.

Negative Binomial Regression

Example: Predicting the number of accidents in a factory per day, where the count data might show more variation than expected from a simple Poisson model.

10. Cox Regression (Proportional Hazards Model): 

Cox regression is used in survival analysis to model the relationship between time-to-event data and predictor variables. It is commonly used in medical research.

Cox Regression

Example: Analyzing the impact of different treatments on the survival time of cancer patients after diagnosis.

11. Stepwise Regression: 

Stepwise regression is a method that automatically selects the most important predictor variables from a larger set of candidates. It is used to build parsimonious models.

Stepwise Regression

Example: Selecting the most important features from a large dataset to predict the performance of a particular product in the market.

12. Time Series Regression: 

Time series regression is used when the dependent variable is a time series (sequential data) and is influenced by lagged values of itself or other independent variables.

Example: Predicting the stock prices of a company based on its past stock prices and economic indicators.

13. Panel Data Regression (Fixed Effects and Random Effects Models): 

Panel data regression is used when you have data collected from multiple entities over time, and you want to control for individual-specific effects (fixed effects) or random variation (random effects).

Example: Analyzing the impact of educational policies on students’ test scores across different schools over several years.

14. Bayesian Regression: 

Bayesian regression is used when you want to incorporate prior knowledge or beliefs about the model parameters. It provides a probabilistic framework for regression analysis.

Bayesian Regression

Example: Estimating the demand for a product based on past sales data while incorporating prior knowledge about similar products and market trends.

15. Quantile Regression: 

Quantile regression is used when you want to model the relationship between the predictors and different quantiles of the dependent variable, offering a more comprehensive view of the data’s distribution.

Quantile Regression

Example: Studying the relationship between weather variables and electricity consumption at various quantiles to understand the impact on different levels of demand.

The choice of regression model depends on the nature of your data, the assumptions of the relationship between variables, the type of dependent variable, and your specific research or prediction objectives. Always validate the chosen model’s assumptions and assess its performance using appropriate evaluation metrics before drawing conclusions from the results.


From the above blog, you have come to know about Regression Algorithms in Machine Learning. Being a supervised learning technique it helps in finding correlation between variables. Regression supervised learning enables you to predict the continuous output variable based on one or more predictor variables. 

You can join Pickl.AI for its range of Data Science courses that includes Machine Learning and Supervised Learning. You’ll be able to develop your skills and expertise in the area of regression in the most effective way. 


  • Ayush Pareek

    Written by:

    I am a programmer, who loves all things code. I have been writing about data science and other allied disciplines like machine learning and artificial intelligence ever since June 2021. You can check out my articles at I have been doing my undergrad in engineering at Jadavpur University since 2019. When not debugging issues, I can be found reading articles online that concern history, languages, and economics, among other topics. I can be reached on LinkedIn and via my email.

You May Also Like