avatarTracyrenee

Summarize

Interview question: What is the difference between regression and classification?

I have been studying machine learning for close to four years now and one thing that has been firmly imprinted into my training is that in supervised machine learning, there are two different types of models, being regression and classification.

Regression

Regression algorithms predict continuous value from the provided input. A supervised learning algorithm uses real values to predict quantitative data like income, height, weight, scores or probability. Machine learning engineers and data scientists mostly use regression algorithms to operate distinct labelled datasets while mapping estimations. Many regression problems involve predicting prices or salaries.

Perhaps one of the simplest regression algorithms is linear regression. In statistics, linear regression is a statistical model that estimates the linear relationship between a scalar response and one or more explanatory variables (also known as dependent and independent variables).

The formula for simple linear regression is:-

The data as it appears against the regression line can be seen in the diagram below:-

The code in Python to compute simple linear regression can be seen below:-

Classification

A procedure in which a model or a function separates the data into discrete values, such as multiple classes of datasets using independent features, is called classification.

A form If-Then rule derives the mapping function. The values classify or forecast the different values like spam or not spam, yes or no, and true or false.

Perhaps one of the simplest formulas to classify a target variable is the sigmoid function. The formula for the sigmoid function can be seen below:-

The sigmoid function can be visualised as a S shape between the values of 0 and 1. If the value is less than 0.5 then it is a 0, otherwise it is a 1.

The formula for the sigmoid function can be easily coded in Python, as seen in the screenshot below:-

In summary, regression and classification are two different types of supervised machine learning techniques that enable a person to make predictions on continuous or discrete values respectively.

Regression
Classification
Supervised Learning
Machine Learning
Recommended from ReadMedium