Linear regression and logistic regression, these two machine learning algorithms which we have to deal with very frequently in the creating or developing of any machine learning model or project.
Even though both the algorithms are most widely in use in machine learning and easy to learn, there is still a lot of confusion learning them.
In this blog, we will be comparing both the algorithms and how they work:
In this we will be covering the following topics:
- Types of Machine Learning Algorithms.
- Regression vs Classification
- What is a Linear Regression?
- What is Logistic Regression?
- Linear vs Logistic Regression
Types of Machine Learning Algorithms
there will be different ways to train machine learning algorithms which have their own advantages and disadvantages. To understand both we first have to take a look at the labeled and unlabelled data.
- Labeled data: data that have both input and output parameters in a machine-readable pattern.
- Unlabeled data: data that have no output data categories, it tries to use patterns of input data.
Coming to the types of machine learning algorithms, they are:
- Supervised learning (Task Driven): in simpler terms in this type of learning the machine learns under guidance i.e. machine learns by feeding them the labeled date.
- Unsupervised learning (Data-Driven): in this, there is no labeled data or guidance the machine has to figure out the data set given and learning method where the agent interacts with the environment by producing some actions and it discovers errors. it must find the hidden patterns about the outputs.
- Reinforcement learning (Learn from Errors): it’s just like a hit and trial concept.
As we discussed in the above lines three types of machine learning algorithms under supervised learning we have two classes of problems are:
1)Classification
2)Regression
So here we can focus only on supervised learning itself because our linear regression and logistic regression are supervised learning algorithms.
Regression vs Classification
Classification:
Classification is about predicting the label.
In the classification problem data is classify up into one of two or more classes, a classification problem with two classes can be pronounce the Binary class and more than two classes as the multi-class classification.
E.g.: in a group of mail classifying between the spam and non-spam this is the binary classification and if we want to classify the mails into the three types then it’s multi-class classification.
Note: it is common for the classification model to predict the continuous value but the continuous value represents the probability of given data points belonging to each output class.
Regression:
Regression is use to predict the continuous quantity.
In general, regression is a predictive analysis use to predict the continuous variables, in regression we don’t have to label the data into different classes instead we have to predict the outcome.
A regression problem always requires the prediction of quantity, a regression problem with multiple input variables is a multivariate regression problem.
Continuous quantity can also be refer as the continuous variable which has an infinite number of possibilities.
What is a Linear Regression?
Linear Regression is a method to predict the dependent variable (let us take) (Y) is based on the values of independent variables (X). however, it can be use for the cases where we want to predict some continuous quantity.
Dependent variable (Y): The response variable whose value needs to be predicted.
Independent variable (X): The predictor variable used to predict the response variable.
thus, The equation below is use to represent the Linear Regression model:
What is Logistic Regression?
Logistic Regression is a method in use to predict a dependent variable, given a set of independent variables. so, such that the dependent variable is categorical.
Dependent Variable (Y): so, The response variable holding the values like Yes or No, 0 or 1, A, B, or C.
Independent Variable(X): The predictor variable used to predict the response variable.
so, The equation below is in use to represent the Logistic Regression model:
Linear Regression vs Logistic Regression
Here is the small table of comparison of both linear and logistic regression:
Linear Regression | Logistic Regression |
It’s used to predict the continuous dependent variable using independent variables | It’s used to predict the categorical dependent variable using the given set of independent variables |
Used for solving Regression problems | also Used for solving Classification problems |
The least-square estimation method is thus used for estimating accuracy | Here maximum likelihood is used |
The relation should be linear between the dependent and independent variable | yet Not required to have a linear relationship between both dependent and independent variables |
The output should be the continuous value | The output should be the categorical value |
written by: Srikanth Bussa
reviewed by: Kothakota Viswanadh
If you are Interested In Machine Learning You Can Check Machine Learning Internship Program
Also Check Other Technical And Non Technical Internship Programs