Sunday, March 31, 2024

STAIR THREE: LOGISTIC REGRESSION

LOGISTIC REGRESSION

A popular supervised machine learning technique for binary classification tasks is logistic regression. It may be used to determine if an email is spam or not, as well as diagnose illnesses by determining whether certain symptoms are present or absent based on test results from patients. 
  • This method converts a linear combination of input information into a probability value between 0 and 1 by using the logistic (or sigmoid) function.
  •  This probability shows how likely it is that an input falls into one of the two predetermined categories. 
  • The capacity of the logistic function to accurately describe the probability of binary events is the basis of the fundamental mechanism of logistic regression. 
  • The logistic function efficiently transfers every real-valued number to a value between 0 and 1 thanks to its characteristic S-shaped curve. 

Logistic Regression[1]

Sigmoid Function [2]



Logistic Function:
A mathematical function called the sigmoid function is utilised to convert expected values into probabilities.
It converts any real number between 0 and 1 into another value.
The logistic regression's result must lie between 0 and 1, and as it cannot be greater than this, it takes the shape of a "S" curve.
The idea of the threshold value, which indicates the likelihood of either 0 or 1, is used in logistic regression. For example, values above the threshold tend towards one, and those below the threshold tend towards zero. For example, values above the threshold tend towards one, and those below the threshold tend towards zero.
There must be a category component to the dependent variable.

It is especially well-suited for binary classification jobs like classifying emails as "spam" or "not spam" because of this property. Logistic regression offers a probabilistic framework that facilitates well-informed decision-making by estimating the likelihood that the dependent variable will fall into a particular group.


Comparison with Linear Regression:

Similar to linear regression, logistic regression is a specific example of the generalized linear model. However, compared to linear regression, the logistic regression model is predicated on quite different assumptions regarding the relationship between the dependent and independent variables. 

Linear Regression

Logistic Regression

Linear regression is used to predict the continuous dependent variable using a given set of independent variables.

Logistic Regression is used to predict the categorical dependent variable using a given set of independent variables.

Linear Regression is used for solving Regression problem.

Logistic Regression is used for solving Classification Problems.

In Linear regression, we predict the value of continuous variables.

In logistic Regression, we predict the values of categorical variables.

The output for Linear Regression must be a continuous value, such as price, age, etc.

The output must be a categorical value such as 0 or 1, Yes or No, etc.

 


In Notebook logistic regression has implemented on the dataset of Prediction of Heart Disease on the students of Framingham city. This dataset contents cigarettes, cigarettes per day, their BMI, heart rate, BP, diabetes and other various factors and habits of students. Depending upon those factors whether he will get any hearth disease or not is predicted.

As, I previously said during the journey I will take readers through hand on journey. I am providing the link of folder which is freely accessible where i have posted various documents in which i have implemented the model on easiest level. Any beginner can easily understand the models.
Those models are implemented in "jupyter notebook" which is the platform for implementing python projects. 

Kindly, refer the link provided below:

References:
[1]https://www.spiceworks.com/tech/artificial-intelligence/articles/what-is-logistic-regression/

No comments:

Post a Comment

Probability and Statistical Operation Using Python

 STATISTICS AND POBABILITY  STATISTICS: The process of gathering information, tabulating it, and interpreting it numerically is known as sta...