Tutorial 36- Logistic Regression Mutliclass Classification(OneVsRest)- Part 3| Data Science

Krish Naik · Beginner ·🛠️ AI Tools & Apps ·6y ago

Key Takeaways

Demonstrates logistic regression for multi-class classification using one-vs-rest approach

Full Transcript

hello on my name is krishna and welcome to my youtube channel so guys today we will be discussing about the logistic regression part 3 and here we are actually going to discuss how we can solve a multi-class classification problem with the help of logistic regression now probably you may have heard only solving binary problem state and binary classification problem statement with the help of logistic regression but now today in this particular video we will try to understand one concept which is called as one versus rest or it is also called as one versus all how does it actually work now if I am talking about one versus rest in logistic regression we know that we actually try to solve a binary classification problem now suppose if I have a problem statement over here and suppose if I have two categories which looks like this right so this is my two classes now in order to solve this particular binary classification problem I try to draw a best fit line in between them and then we try to solve this particular problem right now what is if my output categories are multiple categories like this suppose I have over here a star suppose this is one of the things this is my another classification category right and suppose this is my another category now suppose if I have this kind of solved problem statement can we solve with the help of logistic regression and yes it is definitely possible there is something called as one versus rest now in one versus less what we do is that what what the this particular model will do that is that it will try to you know group this two like suppose there are three categories over here at one time it will try to group these two categories as one category like suppose these two categories will be treated as negative category this category will be treated as positive category now considering this the model will actually create m1 model okay now in the next catechin the next iteration what will happen is that in the next thing is that another model m2 is actually created and now what it does is that in the m2 category first of all it will consider this two categories as one okay and this separate category as a positive category okay in the second case now based on the number of categories again since there are total three categories in the next iteration modern m3 will be created where in these two categories will be treated as one and this particular type category will be treated as a separate positive category so like this combination will be taken up now if I consider this particular example you can see over here suppose I have feature f1 f2 f3 this is my independent feature I have an output feature away as Oh 1 o 2 O 3 so these are all my output features based on the input i1 i2 i3 the output is got as oh one okay similarly if my input is I four i-5 i6 my output is over 2 so like this all the records I have actually having away now how this all categories will get splitted now what will what it will do is that now I have suppose three categories o 1 o 2 O 3 okay now considering this scenario what I told I told you that whenever I have oh one that will be treated as plus 1 okay then I have o2 and o3 will be treated and minus 1 similarly for o 2 in this particular case this will be minus 1 this will get treated as plus 1 and again - 1 o 3 minus 1 minus 1 this will be treated as plus 1 so like this all the combination will be taken up now here you have plus 1 then again here you have minus 1 minus 1 now similarly in o2 you have over here as minus 1 plus 1 and minus 1 now considering this logistic regression when we are using 1 versus rest the first model that it will create it they are going to take this independent features all the independent features right apart from that they will take this first output one feature which will be my output feature and based on this based on this they will create the model m1 ok so the model M 1 will be able to find out whether it is o 1 whether 1 is positive or it is negative or not okay now similarly in the next model that is what it is going to do is that it is going to take this input feature and the output feature will be taken in this particular column that is my ode and for this again the next model M 2 will get created okay and similarly for this particular data finally my output this will be my m3 model now you may be considering that if I give a new test data how will the model actually find out how the urge regression find out the output so whenever I'm giving a new test data the this whole model this m1 m2 m3 model first of all this whole input feature will go to the m1 model and when it goes to the n1 model it will give us one probability value suppose this gives us 0.2 0.1 gave me the answer is point two zero which is my probability that my m2 model basically will give another probability like point three zero okay I can say it as point two five suppose okay Oh point two five then the same data set will be given to the m3 model and suppose the output is somewhere over here is point five five now you can see the sum of all this thing is actually one okay then it will go and check which is the given the highest probability suppose my m3 model is giving the highest probability of 0.5 that basically means my new test data new test data belongs to all three category because my final output that is this oh three is basically having the highest probability okay from all this to that we actually company so this is how one versus rest is actually implemented independently will be creating m1 m2 m3 model and we are not doing it internally the logistic regression is working on that and for that to set this particular parameter there is some parameter called as multi class and there you have to set it as OVR okay when you are doing the coding mechanism it is pretty much simple i will also give you a link where you can see that how it is actually implemented there is just one parameter called as multi class we have to set it as oviya automatically to treat you can solve any classification problem in that particular way and remember for every new test data how many number of categories we have that many number of output values will be getting which will be having the highest probability you can consider that as the output so for my new test data I have got this kind of output you can see that 0.55 is the highest that basically means that it is belonging to the oh three category so this is how the logistic regression one versus rest is actually implemented I have already uploaded all the videos regarding logistic relation this was the part three so I hope you like this particular video please do subscribe the channel if you're not already subscribe I'll see on the next video have a great day anyone lullaby

Original Description

Please join as a member in my channel to get additional benefits like materials in Data Science, live streaming for Members and many more https://www.youtube.com/channel/UCNU_lfiiWBdtULKOw6X0Dig/join code example: https://chrisalbon.com/machine_learning/logistic_regression/one-vs-rest_logistic_regression/ Please do subscribe my other channel too https://www.youtube.com/channel/UCjWY5hREA6FFYrthD0rZNIw Connect with me here: Twitter: https://twitter.com/Krishnaik06 Facebook: https://www.facebook.com/krishnaik06 instagram: https://www.instagram.com/krishnaik06
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Krish Naik · Krish Naik · 0 of 60

← Previous Next →
1 Natural Language Processing|Stemming
Natural Language Processing|Stemming
Krish Naik
2 Natural Language Processing|BagofWords
Natural Language Processing|BagofWords
Krish Naik
3 Gaussian distribution or Normal Distribution in statisctics
Gaussian distribution or Normal Distribution in statisctics
Krish Naik
4 Natural Language Processing|TF-IDF for Machine Learning| Text Prerocessing
Natural Language Processing|TF-IDF for Machine Learning| Text Prerocessing
Krish Naik
5 Log Normal Distribution in Statistics
Log Normal Distribution in Statistics
Krish Naik
6 Covariance in Statistics
Covariance in Statistics
Krish Naik
7 Confusion matrix, Precision, Recall| Data Science Interview questions
Confusion matrix, Precision, Recall| Data Science Interview questions
Krish Naik
8 Tutorial 44-Balanced vs Imbalanced Dataset and how to handle Imbalanced Dataset
Tutorial 44-Balanced vs Imbalanced Dataset and how to handle Imbalanced Dataset
Krish Naik
9 Implementing a Spam classifier in python| Natural Language Processing
Implementing a Spam classifier in python| Natural Language Processing
Krish Naik
10 Tutorial 11-Exploratory Data Analysis(EDA) of Titanic dataset
Tutorial 11-Exploratory Data Analysis(EDA) of Titanic dataset
Krish Naik
11 Face Recognition using open CV and VGG 16 Transfer Learning
Face Recognition using open CV and VGG 16 Transfer Learning
Krish Naik
12 Pedestrian Detection using OpenCV from Videos
Pedestrian Detection using OpenCV from Videos
Krish Naik
13 Face and Eye Detection from Videos using HAAR Cascade Classifier
Face and Eye Detection from Videos using HAAR Cascade Classifier
Krish Naik
14 Reading, Writing and Displaying images with Opencv| OpenCV Tutorial
Reading, Writing and Displaying images with Opencv| OpenCV Tutorial
Krish Naik
15 OpenCV Installation | OpenCV tutorial
OpenCV Installation | OpenCV tutorial
Krish Naik
16 Face and Eye Detection from Images using HAAR Cascade Classifier
Face and Eye Detection from Images using HAAR Cascade Classifier
Krish Naik
17 Car Detection using HAAR Cascade and Opencv from Videos.
Car Detection using HAAR Cascade and Opencv from Videos.
Krish Naik
18 Using OpenFace for Face recognition in Keras
Using OpenFace for Face recognition in Keras
Krish Naik
19 OpenPose Tutorial with Tensorflow
OpenPose Tutorial with Tensorflow
Krish Naik
20 Multiple Linear Regression using python and sklearn
Multiple Linear Regression using python and sklearn
Krish Naik
21 Dimensional Reduction| Principal Component Analysis
Dimensional Reduction| Principal Component Analysis
Krish Naik
22 Movie Recommender System using Python
Movie Recommender System using Python
Krish Naik
23 TPR,FPR,FNR,TNR, Confusion Matrix
TPR,FPR,FNR,TNR, Confusion Matrix
Krish Naik
24 Precision, Recall and F1-Score
Precision, Recall and F1-Score
Krish Naik
25 Artificial Neural Network for Customer's Exit Prediction from Bank
Artificial Neural Network for Customer's Exit Prediction from Bank
Krish Naik
26 GridSearchCV- Select the best hyperparameter for any Classification Model
GridSearchCV- Select the best hyperparameter for any Classification Model
Krish Naik
27 RandomizedSearchCV- Select the best hyperparameter for any Classification Model
RandomizedSearchCV- Select the best hyperparameter for any Classification Model
Krish Naik
28 K Nearest Neighbor classification with Intuition and practical solution
K Nearest Neighbor classification with Intuition and practical solution
Krish Naik
29 K Means Clustering Intuition
K Means Clustering Intuition
Krish Naik
30 Create custom Alexa Skill- Lambda function- Part2
Create custom Alexa Skill- Lambda function- Part2
Krish Naik
31 Hierarchical Clustering intuition
Hierarchical Clustering intuition
Krish Naik
32 Implement Transfer Learning with a generic Code Template
Implement Transfer Learning with a generic Code Template
Krish Naik
33 Gender Classifier and Age Estimator using Resnet Convolution Neural Network
Gender Classifier and Age Estimator using Resnet Convolution Neural Network
Krish Naik
34 Unlock Your Application With Your Face using OpenCV
Unlock Your Application With Your Face using OpenCV
Krish Naik
35 Draw rectangle from webcam and sketch process it on a live feed
Draw rectangle from webcam and sketch process it on a live feed
Krish Naik
36 Complete Life Cycle of a Data Science Project
Complete Life Cycle of a Data Science Project
Krish Naik
37 How we can apply Machine Learning in Finance
How we can apply Machine Learning in Finance
Krish Naik
38 Deep Learning in Medical Science
Deep Learning in Medical Science
Krish Naik
39 How to switch your career to Data Science.
How to switch your career to Data Science.
Krish Naik
40 Linear Regression Mathematical Intuition
Linear Regression Mathematical Intuition
Krish Naik
41 Handle Categorical features using Python
Handle Categorical features using Python
Krish Naik
42 Machine Learning Algorithm- Which one to choose for your Problem?
Machine Learning Algorithm- Which one to choose for your Problem?
Krish Naik
43 DBSCAN Clustering Easily Explained with Implementation
DBSCAN Clustering Easily Explained with Implementation
Krish Naik
44 Curse of Dimensionality Easily explained| Machine Learning
Curse of Dimensionality Easily explained| Machine Learning
Krish Naik
45 Feature Selection Techniques Easily Explained | Machine Learning
Feature Selection Techniques Easily Explained | Machine Learning
Krish Naik
46 Tutorial 29-R square and Adjusted R square Clearly Explained| Machine Learning
Tutorial 29-R square and Adjusted R square Clearly Explained| Machine Learning
Krish Naik
47 Cross Validation using sklearn and python | Machine Learning
Cross Validation using sklearn and python | Machine Learning
Krish Naik
48 Handling Missing Data Easily Explained| Machine Learning
Handling Missing Data Easily Explained| Machine Learning
Krish Naik
49 Deploy Machine Learning Model using Flask
Deploy Machine Learning Model using Flask
Krish Naik
50 Deployment of Deep Learning Model using Flask
Deployment of Deep Learning Model using Flask
Krish Naik
51 How to Visualize Multiple Linear Regression in python
How to Visualize Multiple Linear Regression in python
Krish Naik
52 K Nearest Neighbour Easily Explained with Implementation
K Nearest Neighbour Easily Explained with Implementation
Krish Naik
53 Predicting Heart Disease using Machine Learning
Predicting Heart Disease using Machine Learning
Krish Naik
54 Predicting Lungs Disease using Deep Learning
Predicting Lungs Disease using Deep Learning
Krish Naik
55 Stock Sentiment Analysis using News Headlines
Stock Sentiment Analysis using News Headlines
Krish Naik
56 Random Forest(Bootstrap Aggregation) Easily Explained
Random Forest(Bootstrap Aggregation) Easily Explained
Krish Naik
57 Voting Classifier(Hard Voting and Soft Voting Classifier)
Voting Classifier(Hard Voting and Soft Voting Classifier)
Krish Naik
58 Credit Card Fraud Detection using Machine Learning from Kaggle
Credit Card Fraud Detection using Machine Learning from Kaggle
Krish Naik
59 Hyperparameter Optimization for Xgboost
Hyperparameter Optimization for Xgboost
Krish Naik
60 Tutorial 45-Handling imbalanced Dataset  using python- Part 1
Tutorial 45-Handling imbalanced Dataset using python- Part 1
Krish Naik

Related Reads

Up next
How To Do Complete SEO Audit of a WordPress Website Using Claude AI
Quick Tips - Web Desiign & Ai Tools
Watch →