570 likes | 2.01k Views
** Python Data Science Training : https://www.edureka.co/python ** <br>This Edureka Video on Logistic Regression in Python will give you basic understanding of Logistic Regression Machine Learning Algorithm with examples. In this video, you will also get to see demo on Logistic Regression using Python. Below are the topics covered in this tutorial: <br><br>1. What is Regression? <br>2. What is Logistic Regression? <br>3. Why use Logistic Regression? <br>4. Linear vs Logistic Regression <br>5. Logistic Regression Use Cases <br>6. Logistic Regression Example Demo in Python <br><br>Subscribe to our channel to get video updates. Hit the subscribe button above. <br><br>Machine Learning Tutorial Playlist: https://goo.gl/UxjTxm
E N D
python Data Science Certification Training www.edureka.co/python
Topics Covered in Today’s Training What is Regression? Logistic regression: What and Why? Linear Vs Logistic Regression Use- Cases Demo Data Science Certification Training www.edureka.co/python
What Is Regression Copyright © 2018, edureka and/or its affiliates. All rights reserved.
What is Regression? Regression Analysis is a predictive modelling technique It estimates the relationship between a dependent (target) and an independent variable(predictor) Data Science Certification Training www.edureka.co/python
Logistic Regression: What And Why Copyright © 2018, edureka and/or its affiliates. All rights reserved.
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: 0 OR 1 Reduced Costs Improved Accuracy Yes OR No No Downtime. 24/7 up and running True OR False No Code required to implement RPA High And Low Data Science Certification Training www.edureka.co/python
Why Not Linear Regression? 1 Since our value of Y will be between 0 and 1, the linear line has to be clipped at 0 and 1. Y-axis 0 X-axis Data Science Certification Training www.edureka.co/python
Why Not Linear Regression? 1 With this, our resulting curve cannot be formulated into a single formula. Hence we came up with Logistic! Y-axis 0 X-axis Data Science Certification Training www.edureka.co/python
Logistic Regression Curve The Sigmoid “S” Curve Data Science Certification Training www.edureka.co/python
Logistic Regression Curve The Sigmoid “S” Curve THRESHOLD VALUE 0.5 With this, the threshold value indicates the probability of winning or losing Data Science Certification Training www.edureka.co/python
Logistic Regression Equation The Logistic Regression Equation is derived from the Straight Line Equation Equation of a straight line Range is from –(infinity) to (infinity) Y = C + BIX1 + B2X2 +…. Data Science Certification Training www.edureka.co/python
Logistic Regression Equation The Logistic Regression Equation is derived from the Straight Line Equation Equation of a straight line Range is from –(infinity) to (infinity) Y = C + BIX1 + B2X2 +…. 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 Data Science Certification Training www.edureka.co/python
Logistic Regression Equation The Logistic Regression Equation is derived from the Straight Line Equation Equation of a straight line Range is from –(infinity) to (infinity) Y = C + BIX1 + B2X2 +…. 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 Now , to get the range of Y between 0 and infinity, let’s transform Y Y= 0 then 0 Y= 1 then infinity Y 1-Y Now, the range is between 0 to infinity Data Science Certification Training www.edureka.co/python
Logistic Regression Equation The Logistic Regression Equation is derived from the Straight Line Equation Equation of a straight line Range is from –(infinity) to (infinity) Y = C + BIX1 + B2X2 +…. 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 Now , to get the range of Y between 0 and infinity, let’s transform Y Y= 0 then 0 Y= 1 then infinity Y 1-Y Now, the range is between 0 to infinity Let us transform it further, to get range between –(infinity) and (infinity) Y 1-Y log Y = C + BIX1 + B2X2 +…. Final Logistic Regression Equation Data Science Certification Training www.edureka.co/python
Linear Logistic Copyright © 2018, edureka and/or its affiliates. All rights reserved.
Linear Vs Logistic Regression Linear Regression Logistic Regression 1 Continuous variables Categorical variables 1 2 Solves Classification Problems Solves Regression Problems 2 3 3 Straight line S-Curve Data Science Certification Training www.edureka.co/python
Logistic Regression: Use - Cases Copyright © 2018, edureka and/or its affiliates. All rights reserved.
Logistic Regression: Use - Cases Weather Predictions Data Science Certification Training www.edureka.co/python
Logistic Regression: Use - Cases Classification Problems Data Science Certification Training www.edureka.co/python
Logistic Regression: Use - Cases Determines Illness Data Science Certification Training www.edureka.co/python
Demo Copyright © 2018, edureka and/or its affiliates. All rights reserved.
Titanic Data Analysis 1 1 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. What factors made people more likely to survive the sinking of the Titanic? Data Science Certification Training www.edureka.co/python
Titanic Dataset Data Science Certification Training www.edureka.co/python
Implement Logistic Regression 1 Collecting Data 2 Analyzing Data 3 Data Wrangling 4 Train & Test 5 Accuracy Check Data Science Certification Training www.edureka.co/python
Implement Logistic Regression Collect Data: Import Libraries 1 1 2 3 4 5 Data Science Certification Training www.edureka.co/python
Implement Logistic Regression 1 1 Creating different plot to check relationship between variables Analyzing Data 2 2 3 4 5 Data Science Certification Training www.edureka.co/python
Implement Logistic Regression 1 2 Creating different plot to check relationship between variables Analyzing Data 3 3 4 5 Data Science Certification Training www.edureka.co/python
Implement Logistic Regression 1 2 Clean the data by removing the Nan values and unnecessary columns in the dataset Data Wrangling 3 3 4 5 Data Science Certification Training www.edureka.co/python
Implement Logistic Regression 1 2 3 Build the model on the train data and predict the output on the test data Train & Test Data 4 4 5 logistic = LogisticRegression() logistic.fit(train_X,train_Y) Data Science Certification Training www.edureka.co/python
Implement Logistic Regression 1 2 3 4 Calculate accuracy to check how accurate your results are. Accuracy Check 5 from sklearn.metrics import accuracy_score accuracy_score(y_test,predictions)*100 Data Science Certification Training www.edureka.co/python
SUV Data Analysis 1A 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 What factors made people more interested in buying SUV? Data Science Certification Training www.edureka.co/python
SUV Predictions Data Science Certification Training www.edureka.co/python
Session in a Minute What is regression? Logistic: What & Why? Linear VS Logistic Linear Regression Logistic Regression Reduced Costs 0 And 1 Improved Accuracy Yes And No 1 Categorical variables 1 Continuous variables No Downtime. 24/7 up and running True And False 2 Solves Classification Problems Solves Regression Problems 2 3 3 Straight line Curve S-Curve No Code required to implement RPA High And Low Use - Cases Demo2: SUV Prediction Demo1: Titanic Analysis Data Science Certification Training www.edureka.co/python
Don’t just learn it, MASTER it with Copyright © 2018, edureka and/or its affiliates. All rights reserved.