www.edureka.co/pythonData Science Certification Training python
www.edureka.co/pythonData Science Certification Training Topics Covered in Today’s Training What is Regression? Logistic regression: What and Why? Linear Vs Logistic Regression Use- Cases Demo
Copyright © 2018, edureka and/or its affiliates. All rights reserved. What Is Regression
www.edureka.co/pythonData Science Certification Training What is Regression? Regression Analysis is a predictive modelling technique It estimates the relationship between a dependent (target) and an independent variable(predictor)
Copyright © 2018, edureka and/or its affiliates. All rights reserved. Logistic Regression: What And Why
www.edureka.co/pythonData Science Certification Training Logistic Regression: What And Why? Logistic Regression produces results in a binary format which is used to predict the outcome of a categorical dependent variable. So the outcome should be discrete/ categorical such as: No Code required to implement RPA No Downtime. 24/7 up and running Improved Accuracy Reduced Costs 0 OR 1 Yes OR No True OR False High And Low
www.edureka.co/pythonData Science Certification Training Why Not Linear Regression? Y-axis X-axis 0 1 Since our value of Y will be between 0 and 1, the linear line has to be clipped at 0 and 1.
www.edureka.co/pythonData Science Certification Training Why Not Linear Regression? Y-axis X-axis 0 1 With this, our resulting curve cannot be formulated into a single formula. Hence we came up with Logistic!
www.edureka.co/pythonData Science Certification Training Logistic Regression Curve The Sigmoid “S” Curve
www.edureka.co/pythonData Science Certification Training The Sigmoid “S” Curve With this, the threshold value indicates the probability of winning or losing 0.5 THRESHOLD VALUE Logistic Regression Curve
www.edureka.co/pythonData Science Certification Training The Logistic Regression Equation is derived from the Straight Line Equation Logistic Regression Equation Equation of a straight line Y = C + BIX1 + B2X2 +…. Range is from –(infinity) to (infinity)
www.edureka.co/pythonData Science Certification Training The Logistic Regression Equation is derived from the Straight Line Equation Logistic Regression Equation Equation of a straight line Y = C + BIX1 + B2X2 +…. Range is from –(infinity) to (infinity) Let’s try to reduce the Logistic Regression Equation from Straight Line Equation Y = C + BIX1 + B2X2 +…. In Logistic equation Y can be only from 0 to 1
www.edureka.co/pythonData Science Certification Training Logistic Regression Equation Equation of a straight line Range is from –(infinity) to (infinity) Let’s try to reduce the Logistic Regression Equation from Straight Line Equation In Logistic equation Y can be only from 0 to 1 Now , to get the range of Y between 0 and infinity, let’s transform Y Now, the range is between 0 to infinity The Logistic Regression Equation is derived from the Straight Line Equation Y = C + BIX1 + B2X2 +…. Y = C + BIX1 + B2X2 +…. Y= 0 then 0 Y= 1 then infinity Y 1-Y
www.edureka.co/pythonData Science Certification Training Logistic Regression Equation Equation of a straight line Range is from –(infinity) to (infinity) Let’s try to reduce the Logistic Regression Equation from Straight Line Equation In Logistic equation Y can be only from 0 to 1 Now , to get the range of Y between 0 and infinity, let’s transform Y Now, the range is between 0 to infinity Let us transform it further, to get range between –(infinity) and (infinity) log Y 1-Y Y = C + BIX1 + B2X2 +…. Final Logistic Regression Equation The Logistic Regression Equation is derived from the Straight Line Equation Y = C + BIX1 + B2X2 +…. Y = C + BIX1 + B2X2 +…. Y= 0 then 0 Y= 1 then infinity Y 1-Y
Copyright © 2018, edureka and/or its affiliates. All rights reserved. Linear Logistic
www.edureka.co/pythonData Science Certification Training Linear Vs Logistic Regression Linear Regression Logistic Regression Continuous variables1 Solves Regression Problems2 Straight line3 Categorical variables1 Solves Classification Problems2 S-Curve3
Copyright © 2018, edureka and/or its affiliates. All rights reserved. Logistic Regression: Use - Cases
www.edureka.co/pythonData Science Certification Training Logistic Regression: Use - Cases Weather Predictions
www.edureka.co/pythonData Science Certification Training Logistic Regression: Use - Cases Classification Problems
www.edureka.co/pythonData Science Certification Training Logistic Regression: Use - Cases Determines Illness
Copyright © 2018, edureka and/or its affiliates. All rights reserved. Demo
www.edureka.co/pythonData Science Certification Training 1 Titanic Data Analysis Explore titanic dataset and explore about the people, both those who survived and those who did not. With today's technology, answering questions through data analysis is now easier than ever. 1 What factors made people more likely to survive the sinking of the Titanic?
www.edureka.co/pythonData Science Certification Training Titanic Dataset
www.edureka.co/pythonData Science Certification Training Implement Logistic Regression Analyzing Data 1 2 3 4 5 Collecting Data Train & Test Data Wrangling Accuracy Check
www.edureka.co/pythonData Science Certification Training Implement Logistic Regression 1 2 3 4 5 Collect Data: Import Libraries
www.edureka.co/pythonData Science Certification Training Implement Logistic Regression 1 2 3 4 5 Analyzing Data Creating different plot to check relationship between variables
www.edureka.co/pythonData Science Certification Training Implement Logistic Regression 1 2 3 4 5 Analyzing Data Creating different plot to check relationship between variables
www.edureka.co/pythonData Science Certification Training Implement Logistic Regression 1 2 3 4 5 Data Wrangling Clean the data by removing the Nan values and unnecessary columns in the dataset
www.edureka.co/pythonData Science Certification Training Implement Logistic Regression 1 2 3 4 5 Train & Test Data Build the model on the train data and predict the output on the test data logistic = LogisticRegression() logistic.fit(train_X,train_Y)
www.edureka.co/pythonData Science Certification Training Implement Logistic Regression 1 2 3 4 5 Accuracy Check Calculate accuracy to check how accurate your results are. from sklearn.metrics import accuracy_score accuracy_score(y_test,predictions)*100
www.edureka.co/pythonData Science Certification Training SUV Data Analysis What factors made people more interested in buying SUV? 1 A car company has released a new SUV in the market. Using the previous data about the sales of their SUV’s, they want to predict the category of people who might be interested in buying this. 2
www.edureka.co/pythonData Science Certification Training SUV Predictions
www.edureka.co/pythonData Science Certification Training Session in a Minute What is regression? Logistic: What & Why? Use - Cases Linear VS Logistic Demo2: SUV PredictionDemo1: Titanic Analysis No Code required to implement RPA No Downtime. 24/7 up and running Improved Accuracy Reduced Costs 0 And 1 Yes And No True And False High And Low Linear Regression Logistic Regression Continuous variables1 Solves Regression Problems2 Straight line Curve3 Categorical variables1 Solves Classification Problems2 S-Curve3
Copyright © 2018, edureka and/or its affiliates. All rights reserved. Don’t just learn it, MASTER it with
Logistic Regression in Python | Logistic Regression Example | Machine Learning Algorithms | Edureka

Logistic Regression in Python | Logistic Regression Example | Machine Learning Algorithms | Edureka

  • 1.
  • 2.
    www.edureka.co/pythonData Science CertificationTraining Topics Covered in Today’s Training What is Regression? Logistic regression: What and Why? Linear Vs Logistic Regression Use- Cases Demo
  • 3.
    Copyright © 2018,edureka and/or its affiliates. All rights reserved. What Is Regression
  • 4.
    www.edureka.co/pythonData Science CertificationTraining What is Regression? Regression Analysis is a predictive modelling technique It estimates the relationship between a dependent (target) and an independent variable(predictor)
  • 5.
    Copyright © 2018,edureka and/or its affiliates. All rights reserved. Logistic Regression: What And Why
  • 6.
    www.edureka.co/pythonData Science CertificationTraining Logistic Regression: What And Why? Logistic Regression produces results in a binary format which is used to predict the outcome of a categorical dependent variable. So the outcome should be discrete/ categorical such as: No Code required to implement RPA No Downtime. 24/7 up and running Improved Accuracy Reduced Costs 0 OR 1 Yes OR No True OR False High And Low
  • 7.
    www.edureka.co/pythonData Science CertificationTraining Why Not Linear Regression? Y-axis X-axis 0 1 Since our value of Y will be between 0 and 1, the linear line has to be clipped at 0 and 1.
  • 8.
    www.edureka.co/pythonData Science CertificationTraining Why Not Linear Regression? Y-axis X-axis 0 1 With this, our resulting curve cannot be formulated into a single formula. Hence we came up with Logistic!
  • 9.
    www.edureka.co/pythonData Science CertificationTraining Logistic Regression Curve The Sigmoid “S” Curve
  • 10.
    www.edureka.co/pythonData Science CertificationTraining The Sigmoid “S” Curve With this, the threshold value indicates the probability of winning or losing 0.5 THRESHOLD VALUE Logistic Regression Curve
  • 11.
    www.edureka.co/pythonData Science CertificationTraining The Logistic Regression Equation is derived from the Straight Line Equation Logistic Regression Equation Equation of a straight line Y = C + BIX1 + B2X2 +…. Range is from –(infinity) to (infinity)
  • 12.
    www.edureka.co/pythonData Science CertificationTraining The Logistic Regression Equation is derived from the Straight Line Equation Logistic Regression Equation Equation of a straight line Y = C + BIX1 + B2X2 +…. Range is from –(infinity) to (infinity) Let’s try to reduce the Logistic Regression Equation from Straight Line Equation Y = C + BIX1 + B2X2 +…. In Logistic equation Y can be only from 0 to 1
  • 13.
    www.edureka.co/pythonData Science CertificationTraining Logistic Regression Equation Equation of a straight line Range is from –(infinity) to (infinity) Let’s try to reduce the Logistic Regression Equation from Straight Line Equation In Logistic equation Y can be only from 0 to 1 Now , to get the range of Y between 0 and infinity, let’s transform Y Now, the range is between 0 to infinity The Logistic Regression Equation is derived from the Straight Line Equation Y = C + BIX1 + B2X2 +…. Y = C + BIX1 + B2X2 +…. Y= 0 then 0 Y= 1 then infinity Y 1-Y
  • 14.
    www.edureka.co/pythonData Science CertificationTraining Logistic Regression Equation Equation of a straight line Range is from –(infinity) to (infinity) Let’s try to reduce the Logistic Regression Equation from Straight Line Equation In Logistic equation Y can be only from 0 to 1 Now , to get the range of Y between 0 and infinity, let’s transform Y Now, the range is between 0 to infinity Let us transform it further, to get range between –(infinity) and (infinity) log Y 1-Y Y = C + BIX1 + B2X2 +…. Final Logistic Regression Equation The Logistic Regression Equation is derived from the Straight Line Equation Y = C + BIX1 + B2X2 +…. Y = C + BIX1 + B2X2 +…. Y= 0 then 0 Y= 1 then infinity Y 1-Y
  • 15.
    Copyright © 2018,edureka and/or its affiliates. All rights reserved. Linear Logistic
  • 16.
    www.edureka.co/pythonData Science CertificationTraining Linear Vs Logistic Regression Linear Regression Logistic Regression Continuous variables1 Solves Regression Problems2 Straight line3 Categorical variables1 Solves Classification Problems2 S-Curve3
  • 17.
    Copyright © 2018,edureka and/or its affiliates. All rights reserved. Logistic Regression: Use - Cases
  • 18.
    www.edureka.co/pythonData Science CertificationTraining Logistic Regression: Use - Cases Weather Predictions
  • 19.
    www.edureka.co/pythonData Science CertificationTraining Logistic Regression: Use - Cases Classification Problems
  • 20.
    www.edureka.co/pythonData Science CertificationTraining Logistic Regression: Use - Cases Determines Illness
  • 21.
    Copyright © 2018,edureka and/or its affiliates. All rights reserved. Demo
  • 22.
    www.edureka.co/pythonData Science CertificationTraining 1 Titanic Data Analysis Explore titanic dataset and explore about the people, both those who survived and those who did not. With today's technology, answering questions through data analysis is now easier than ever. 1 What factors made people more likely to survive the sinking of the Titanic?
  • 23.
  • 24.
    www.edureka.co/pythonData Science CertificationTraining Implement Logistic Regression Analyzing Data 1 2 3 4 5 Collecting Data Train & Test Data Wrangling Accuracy Check
  • 25.
    www.edureka.co/pythonData Science CertificationTraining Implement Logistic Regression 1 2 3 4 5 Collect Data: Import Libraries
  • 26.
    www.edureka.co/pythonData Science CertificationTraining Implement Logistic Regression 1 2 3 4 5 Analyzing Data Creating different plot to check relationship between variables
  • 27.
    www.edureka.co/pythonData Science CertificationTraining Implement Logistic Regression 1 2 3 4 5 Analyzing Data Creating different plot to check relationship between variables
  • 28.
    www.edureka.co/pythonData Science CertificationTraining Implement Logistic Regression 1 2 3 4 5 Data Wrangling Clean the data by removing the Nan values and unnecessary columns in the dataset
  • 29.
    www.edureka.co/pythonData Science CertificationTraining Implement Logistic Regression 1 2 3 4 5 Train & Test Data Build the model on the train data and predict the output on the test data logistic = LogisticRegression() logistic.fit(train_X,train_Y)
  • 30.
    www.edureka.co/pythonData Science CertificationTraining Implement Logistic Regression 1 2 3 4 5 Accuracy Check Calculate accuracy to check how accurate your results are. from sklearn.metrics import accuracy_score accuracy_score(y_test,predictions)*100
  • 31.
    www.edureka.co/pythonData Science CertificationTraining SUV Data Analysis What factors made people more interested in buying SUV? 1 A car company has released a new SUV in the market. Using the previous data about the sales of their SUV’s, they want to predict the category of people who might be interested in buying this. 2
  • 32.
  • 33.
    www.edureka.co/pythonData Science CertificationTraining Session in a Minute What is regression? Logistic: What & Why? Use - Cases Linear VS Logistic Demo2: SUV PredictionDemo1: Titanic Analysis No Code required to implement RPA No Downtime. 24/7 up and running Improved Accuracy Reduced Costs 0 And 1 Yes And No True And False High And Low Linear Regression Logistic Regression Continuous variables1 Solves Regression Problems2 Straight line Curve3 Categorical variables1 Solves Classification Problems2 S-Curve3
  • 34.
    Copyright © 2018,edureka and/or its affiliates. All rights reserved. Don’t just learn it, MASTER it with