Logistic Regression
Logistic Regression
Logistic regression is a supervised machine learning algorithm mainly used for classification tasks where
the goal is to predict the probability that an instance of belonging to a given class or not. It is a kind of
statistical algorithm, which analyze the relationship between a set of independent variables and the
dependent binary variables. It is a powerful tool for decision-making. For example email spam or not.
Logistic Regression
Logistic regression is a supervised machine learning algorithm mainly used for classification tasks where
the goal is to predict the probability that an instance of belonging to a given class. It is used for
classification algorithms its name is logistic regression.
it’s referred to as regression because it takes the output of the linear regression function as input and uses a sigmoid function to
estimate the probability for the given class.
Logistic Regression:
It is used for predicting the categorical dependent variable using a given set of
independent variables.
On the basis of the categories, Logistic Regression can be classified into three
types:
1. Binomial: In binomial Logistic regression, there can be only two possible types of the dependent
variables, such as 0 or 1, Pass or Fail, etc.
2. Multinomial: In multinomial Logistic regression, there can be 3 or more possible unordered types of
the dependent variable, such as “cat”, “dogs”, or “sheep”
3. Ordinal: In ordinal Logistic regression, there can be 3 or more possible ordered types of dependent
variables, such as “low”, “Medium”, or “High”.
Independent variables: The input characteristics or predictor factors applied to the dependent
variable’s predictions.
Dependent variable: The target variable in a logistic regression model, which we are trying to predict.
Logistic function: The formula used to represent how the independent and dependent variables relate
to one another. The logistic function transforms the input variables into a probability value between 0
and 1, which represents the likelihood of the dependent variable being 1 or 0.
Odds: It is the ratio of something occurring to something not occurring. it is different from probability
as the probability is the ratio of something occurring to everything that could possibly occur.
Log-odds: The log-odds, also known as the logit function, is the natural logarithm of the odds. In
logistic regression, the log odds of the dependent variable are modeled as a linear combination of the
independent variables and the intercept.
Coefficient: The logistic regression model’s estimated parameters, show how the independent and
dependent variables relate to one another.
Intercept: A constant term in the logistic regression model, which represents the log odds when all
independent variables are equal to zero.
Maximum likelihood estimation: The method used to estimate the coefficients of the logistic
regression model, which maximizes the likelihood of observing the data given the model.
Sigmoid Function
Now we use the sigmoid function where the input will be z and we find the
probability between 0 and 1. i.e predicted y.
As shown above, the figure sigmoid function converts the continuous variable data
into the probability i.e. between 0 and 1.
tends towards 1 as
tends towards 0 as
is always bounded between 0 and 1
The difference between linear regression and logistic regression is that linear regression output is the continuous value that can be
anything while logistic regression predicts the probability that an instance belongs to a given class or not.
accuracy.
The decision for the value of the threshold value is majorly affected by the values
of precision and recall. Ideally, we want both precision and recall to be 1, but this
seldom is the case.
Whether you're preparing for your first job interview or aiming to upskill in this
ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We
provide top-quality content at affordable prices, all geared towards accelerating
your growth in a time-bound manner. Join the millions we've already empowered,
and we're here to do the same for you. Don't miss out -