General

What is Logistic Regression

Logistic Regression

General August 17, 2019

In Previous topic we came across the first most machine learning algorithm which is Linear Regression. Now it’s learn about one of the linear algorithm in this section.

Python Machine Learning

What is Logistic Regression?

Logistic Regression is used to solve the classification problems, so it’s called as Classification Algorithm that models the probability of output class.

  • It is a classification problem where your target element is categorical
  • Unlike in Linear Regression, in Logistic regression the output required is represented in discrete values like binary 0 and
  • It estimates relationship between a dependent variable (target) and one or more independent variable (predictors) where dependent variable is categorical/nominal.

Logistic Regression

Sigmoid Function:

  • It is the logistic expression especially used in Logistic Regression.
  • The sigmoid function converts any line into a curve which has discrete values like binary 0 and.
  • In this session let’s see how a continuous linear regression can be manipulated and converted into Classifies Logistic.

Sigmoid function

Where,

P represents Probability of Output class Y represents predicted output

Machine Learning Certification Training

Learning Logistic Regression Model:

Consider a scenario where we need to classify whether a patient has diabetes or not. If we use linear regression for this problem, there is a need for setting up a threshold based on which classification can be done. Say if the actual class is malignant, predicted continuous value 0.3 and the threshold value is 0.6, the data point will be classified as not malignant which can lead to serious consequence in real time.

From this example, it can be inferred that linear regression is not suitable for classification problem. Linear regression is unbounded, and this brings logistic regression into picture. Their value strictly ranges from 0 to 1.

Comparing Linear Probability Model and Logistic Regression Model:

As Linear Regression is unbounded, it’s not useful to solve classification problems. So this is where Logistic Regression comes into picture.

Learning logistic regression model

We know that the below expression is the Linear equation used in Linear Regression.

Logistic regression equation

x is the independent variable

Now let’s see when what happens when we related both the algorithm equations.

logistic regression algorithm

When we substitute the linear equation ?□ in the probability equation we get the below result.

Logistic regression probability equation

From the above equation we can see that the value of P lies in between 0 and 1. So the graphical representation of the same will be as below.

Regression graphical representation

Machine Learning Interview Questions and Answers

Types of Logistic Regression:

  • Binary Logistic Regression
  • Multinomial Logistic Regression
  • Ordinal Logistic Regression

For the model to be a cent percent accurate one, we need to calculate and find out few parameters of the algorithm in order to check how accurate our Binary Logistic Regression model is.

The key parameters we calculate and check are dependent of the topic called CONFUSION MATRIX.

What is the Confusion Matrix?

The confusion matrix is a type of table used to define the characteristics of Classification problems.

Negative(0)Positive1(1)
Negative(0)True NegativeFalse Positive
Positive(1)False NegativeTrue Positive

The below are few expressions calculated in order to find how accurate the prediction of the model is.

  • Accuracy
  • Recall
  • Precision
  • F1 score

Let’s see the mathematical formulae for these parameters.

Logistic regression mathematical formula
Machine Learning Batch Shedule

Besant Technologies – Chennai & Bangalore Branch Locations

Besant Technologies - Velachery Branch

Plot No. 119, No.8, 11th Main road, Vijaya nagar,

Velachery, Chennai - 600 042

Tamil Nadu, India

Landmark - Reliance Digital Opposite Street

Besant Technologies - Tambaram Branch

No.2A, 1st Floor, Duraisami Reddy Street,

West Tambaram, Chennai - 600 045

Tamil Nadu, India

Landmark - Near By Passport Seva

Besant Technologies - OMR Branch

No. 5/318, 2nd Floor, Sri Sowdeswari Nagar,

OMR, Okkiyam Thoraipakkam, Chennai - 600 097

Tamil Nadu, India

Landmark - Behind Okkiyampet Bus Stop,

Besant Technologies - Porur Branch

No. 180/84, 1st Floor, Karnataka Bank Building,

Trunk Road, Porur, Chennai - 600 116

Tamil Nadu, India

Landmark - Opposite to Gopalakrishna Theatre

Besant Technologies - Anna Nagar Branch

Plot No:1371, 28th street kambar colony,

I Block, Anna Nagar, Chennai - 600 040

Tamil Nadu, India

Landmark - Behind Reliance Fresh

Besant Technologies - T.Nagar Branch

Old No:146/2- New No: 48,

Habibullah Road,T.Nagar, Chennai - 600 017

Tamil Nadu, India

Landmark - Opposite to SGS Sabha

Besant Technologies - Thiruvanmiyur Branch

22/67, 1st Floor, North mada street, Kamaraj Nagar

Thiruvanmiyur, Chennai 600041

Tamil Nadu, India

Landmark - Above Thiruvanmiyur ICICI Bank

Besant Technologies - Siruseri Branch

No. 4/76, Ambedkar Street, OMR Road, Egatoor, Navallur,

Siruseri, Chennai 600130

Tamil Nadu, India

Landmark - Near Navallur Toll Gate, Next to Yamaha Showroom

Besant Technologies - Maraimalai Nagar Branch

No.37, Ground Floor, Thiruvalluvar Salai,

Maraimalai Nagar,Chennai 603209

Tamil Nadu, India

Landmark - Near to Maraimalai Nagar Arch

Besant Technologies - BTM Layout Branch

No 2, Ground floor, 29th Main Road,

Kuvempu Nagar,BTM Layout 2nd Coming from Silkboard,

AXA company signal, Stage, Bangalore - 560 076

Karnataka, India

Landmark - Next to OI Play School

Besant Technologies - Marathahalli Branch

No. 43/2, 2nd Floor, VMR Arcade,

Varthur Main Road, Silver Springs Layout,

Munnekollal, Marathahalli, Bengaluru - 560037

Karnataka, India

Landmark - Near Kundalahalli Gate Signal

Besant Technologies - Rajaji Nagar Branch

No. 309/43, JRS Ecstasy, First Floor,

59th Cross, 3rd Block, Bashyam Circle,

Rajaji Nagar, Bangalore - 560 010

Karnataka, India

Landmark - Near Bashyam Circle

Besant Technologies - Jaya Nagar Branch

No. 2nd Floor,1575,11th Main Road,

4th T-Block, Pattabhirama Nagar,

Jaya Nagar, Bangalore - 560 041

Karnataka, India

Landmark - Opposite to Shanthi Nursing Home

Besant Technologies - Kalyan Nagar Branch

No.513, 4th Cross Rd

2nd Block, HRBR Layout,

Kalyan Nagar, Bangalore - 560 043

Karnataka, India

Landmark - Opposite to kalayan nagar Axis Bank

Besant Technologies - Electronic City Branch

No. 7, 3rd Floor, Ganga Enclave,

Neeladri Road, Karuna Nagar, Doddathoguru Village,

Electronics City Phase 1, Electronic City,

Bangalore - 560100, karnataka, India

Landmark - Adjacent to HDFC Bank and State Bank Of India

Besant Technologies - Indira Nagar Branch

No.54, 1st Floor,

5th Main kodihalli,

Bengaluru, Karnataka 560008, India

Landmark - Behind Leela Palace Hotel,

Besant Technologies - HSR Layout Branch

Plot No. 2799 & 2800, 27th Main,

1st Sector, HSR Layout,

Bengaluru, Karnataka 560102, India

Besant Technologies - Hebbal Branch

No.29, 2nd Floor, SN Complex,

14th Main Road, E-Block Extention, Sahakara Nagar,

Bengaluru, Karnataka -560092, India

Scroll Up