SlideShare a Scribd company logo
1 of 28
Support Vector Machine (SVM)
Machine Learning
Introduction:
● Support Vector Machine is a supervised machine learning problem where to try to
find a hyperplane that best separates two classes.
● It is considered as one of the best algorithm as it can handle high-dimensional data,
is effective in cases with limited training samples, and can handle nonlinear
classification using kernel functions.
● SVM can be used for both regression and classification tasks, but generally work best
in classification problem.
What is SVM ?
Types of SVM Algorithm:
1. Simple or Linear SVM: When the data is perfectly linearly separable only then we
can use Linear SVM. Perfectly linearly separable means that the data points can be
classified into 2 classes by using a single straight line(if 2D).
1. Kernel or Non-Linear SVM: When the data is not linearly separable then we can
use Non-Linear SVM, which means when the data points cannot be separated into
2 classes by using a straight line (if 2D) then we use some advanced techniques
like kernel tricks to classify them. In most real-world applications we do not find
linearly separable data points hence we use kernel trick to solve them.
Important Terms:
1. Support Vectors: These are the points that
are closest to the hyperplane. A separating
line will be defined with the help of these data
points.
1. Margin: it is the distance between the
hyperplane and the observations closest to
the hyperplane (support vectors). There are
two types of margins hard margin and soft
margin.
1. Hyperplane: The best-line or decision
boundary that can segregate N-dimensional
space into classes so that we can easily put
the new data point in the correct category.
Hyper Plane:
Hyperplanes are decision boundaries that help classify the data points. Data points
falling on either side of the hyperplane can be attributed to different classes.
dimension of the hyperplane = the number of features
If, number of input features is 2, hyperplane is just a line.
number of input features is 3, hyperplane becomes a two-dimensional plane.
Objective:
Objective of the SVM algorithm
is to find a hyperplane that, to
the best degree possible,
separates data points of one
class from those of another
class.
How does SVM work ?
Suppose we have a dataset that has two classes (green and blue). We
want to classify that the new data point as either blue or green.
How does SVM work ?
Best Hyperplane = Finding
different hyperplanes which
classify the labels in the best
way then it will choose the
one which is farthest from the
data points or the one which
has a maximum margin.
Hard Margin SVM (Dot Product):
● Consider a random point X and we
want to know whether it lies on
the right side of the plane or the
left side of the plane (positive or
negative).
● First we assume this point is a
vector (X) and then we make a
vector (w) which is perpendicular
to the hyperplane.
Decision Rule:
We all know the equation of a
hyperplane is w.x+b=0 where w is
a vector normal to hyperplane and
b is an offset.
Soft margin SVM:
● In real-life applications, we rarely
encounter datasets that are perfectly
linearly separable. Instead, we often
come across datasets that are either
nearly linearly separable or entirely
non-linearly separable.
● To tackle this problem what we do is
modify that equation in such a way that
it allows few misclassifications that
means it allows few points to be
wrongly classified.
Kernel in SVM:
● Kernels = functions that helps to convert lower dimension space to a higher
dimension space using some quadratic functions.
Types of Kernel Functions:
● Polynomial Kernel = Separate data of Degree 2.
● RBF Kernel = (Most used) Lift our samples onto a higher-dimensional feature
● Bessel function Kernel: Used for eliminating the cross term in mathematical
functions
● Anova Kernel: Multidimensional regression problems
Right Kernel = What type of Dataset we are working on?
Linear Dataset = Linear Kernel Function
Complex Dataset = RBF Kernel Function
Import Necessary Libraries
Load Data from CSV file
Distribution of the Classes
Identification of the unwanted rows
Remove unwanted Columns
Divide data as Train/Test
Modeling
Model Output :
Evaluation of Results
● Accuracy: The portion of correctly classified instances among the
total instances.
● Precision and recall: Precision measures the portion of true
positive predictions among all positive predictions while recall
measures the portion of true positive predictions among all
actual positives.
● F1 Score: The harmonic mean of precision and recall, which
provides a balance between the two metrics.
● Support: Support refers to the number of occurrences of each
class in the actual data. It represents the number of samples
belonging to each class.
Metrics:
● SVM works better when the data is linear
● It is more effective in high dimensions
● With the help of the kernel trick, we can solve any complex problem
● SVM is not sensitive to outliers
● Can help us with Image Classification
Advantages of SVM
● Choosing a good kernel is not easy
● It does not show good result on a big dataset
● The SVM hyperparameters are Cost -C and gamma.
● It is not easy to fine-tune these hyper-parameters.
● It is hard to visualize their impact
Disadvantage of SVM
● We have demonstrated SVM by segregation two different classes.
● We discussed its concept of working, math intuition behind SVM,
implementation in python, the tricks to classify non-linear datasets, Pros and
cons, and finally, we solved a problem with the help of SVM.
Support vector machine is an elegant and powerful algorithm.
Conclusion:
THANK YOU!
Any Questions?

More Related Content

Similar to Classification-Support Vector Machines.pptx

SVM & KNN Presentation.pptx
SVM & KNN Presentation.pptxSVM & KNN Presentation.pptx
SVM & KNN Presentation.pptxMohamedMonir33
 
Support Vector Machine ppt presentation
Support Vector Machine ppt presentationSupport Vector Machine ppt presentation
Support Vector Machine ppt presentationAyanaRukasar
 
Support Vector Machine topic of machine learning.pptx
Support Vector Machine topic of machine learning.pptxSupport Vector Machine topic of machine learning.pptx
Support Vector Machine topic of machine learning.pptxCodingChamp1
 
Introduction to Machine Learning Elective Course
Introduction to Machine Learning Elective CourseIntroduction to Machine Learning Elective Course
Introduction to Machine Learning Elective CourseMayuraD1
 
Support Vector Machines- SVM
Support Vector Machines- SVMSupport Vector Machines- SVM
Support Vector Machines- SVMCarlo Carandang
 
properties, application and issues of support vector machine
properties, application and issues of support vector machineproperties, application and issues of support vector machine
properties, application and issues of support vector machineDr. Radhey Shyam
 
Lec_XX_Support Vector Machine Algorithm.pptx
Lec_XX_Support Vector Machine Algorithm.pptxLec_XX_Support Vector Machine Algorithm.pptx
Lec_XX_Support Vector Machine Algorithm.pptxpiwig56192
 
svm-proyekt.pptx
svm-proyekt.pptxsvm-proyekt.pptx
svm-proyekt.pptxElinEliyev
 
Kate · SlidesCarnival.pptx
Kate · SlidesCarnival.pptxKate · SlidesCarnival.pptx
Kate · SlidesCarnival.pptxAhmedSalah48055
 
Supervised and unsupervised learning
Supervised and unsupervised learningSupervised and unsupervised learning
Supervised and unsupervised learningAmAn Singh
 
Support Vector Machine.pptx
Support Vector Machine.pptxSupport Vector Machine.pptx
Support Vector Machine.pptxHarishNayak44
 
Support Vector machine(SVM) and Random Forest
Support Vector machine(SVM) and Random ForestSupport Vector machine(SVM) and Random Forest
Support Vector machine(SVM) and Random Forestumarcybermind
 
Machine learning session8(svm nlp)
Machine learning   session8(svm nlp)Machine learning   session8(svm nlp)
Machine learning session8(svm nlp)Abhimanyu Dwivedi
 

Similar to Classification-Support Vector Machines.pptx (20)

Support vector machines
Support vector machinesSupport vector machines
Support vector machines
 
SVM & KNN Presentation.pptx
SVM & KNN Presentation.pptxSVM & KNN Presentation.pptx
SVM & KNN Presentation.pptx
 
Support Vector Machine ppt presentation
Support Vector Machine ppt presentationSupport Vector Machine ppt presentation
Support Vector Machine ppt presentation
 
Support vector machines
Support vector machinesSupport vector machines
Support vector machines
 
Support Vector Machine topic of machine learning.pptx
Support Vector Machine topic of machine learning.pptxSupport Vector Machine topic of machine learning.pptx
Support Vector Machine topic of machine learning.pptx
 
Ai saturdays presentation
Ai saturdays presentationAi saturdays presentation
Ai saturdays presentation
 
Introduction to Machine Learning Elective Course
Introduction to Machine Learning Elective CourseIntroduction to Machine Learning Elective Course
Introduction to Machine Learning Elective Course
 
Support Vector Machines- SVM
Support Vector Machines- SVMSupport Vector Machines- SVM
Support Vector Machines- SVM
 
properties, application and issues of support vector machine
properties, application and issues of support vector machineproperties, application and issues of support vector machine
properties, application and issues of support vector machine
 
Lec_XX_Support Vector Machine Algorithm.pptx
Lec_XX_Support Vector Machine Algorithm.pptxLec_XX_Support Vector Machine Algorithm.pptx
Lec_XX_Support Vector Machine Algorithm.pptx
 
svm-proyekt.pptx
svm-proyekt.pptxsvm-proyekt.pptx
svm-proyekt.pptx
 
Kate · SlidesCarnival.pptx
Kate · SlidesCarnival.pptxKate · SlidesCarnival.pptx
Kate · SlidesCarnival.pptx
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
 
Supervised and unsupervised learning
Supervised and unsupervised learningSupervised and unsupervised learning
Supervised and unsupervised learning
 
Support Vector Machine.pptx
Support Vector Machine.pptxSupport Vector Machine.pptx
Support Vector Machine.pptx
 
SVM_notes.pdf
SVM_notes.pdfSVM_notes.pdf
SVM_notes.pdf
 
Support Vector Machines ( SVM )
Support Vector Machines ( SVM ) Support Vector Machines ( SVM )
Support Vector Machines ( SVM )
 
Support Vector machine(SVM) and Random Forest
Support Vector machine(SVM) and Random ForestSupport Vector machine(SVM) and Random Forest
Support Vector machine(SVM) and Random Forest
 
lec10svm.ppt
lec10svm.pptlec10svm.ppt
lec10svm.ppt
 
Machine learning session8(svm nlp)
Machine learning   session8(svm nlp)Machine learning   session8(svm nlp)
Machine learning session8(svm nlp)
 

More from Ciceer Ghimirey

Machine Vision Concepts ,Application & Components.pptx
Machine Vision Concepts ,Application & Components.pptxMachine Vision Concepts ,Application & Components.pptx
Machine Vision Concepts ,Application & Components.pptxCiceer Ghimirey
 
Lab 5 Linux File Structure and Hierarchy.pptx
Lab 5 Linux File Structure and Hierarchy.pptxLab 5 Linux File Structure and Hierarchy.pptx
Lab 5 Linux File Structure and Hierarchy.pptxCiceer Ghimirey
 
Lab 4 -Linux Files, Directories and Basic Commands Part-2.pptx
Lab 4 -Linux Files, Directories and Basic Commands Part-2.pptxLab 4 -Linux Files, Directories and Basic Commands Part-2.pptx
Lab 4 -Linux Files, Directories and Basic Commands Part-2.pptxCiceer Ghimirey
 
Lab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptxLab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptxCiceer Ghimirey
 
Install Linux OS in Virtual Box.pptx
Install Linux OS in Virtual Box.pptxInstall Linux OS in Virtual Box.pptx
Install Linux OS in Virtual Box.pptxCiceer Ghimirey
 
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptx
 Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptxCiceer Ghimirey
 
Complete WordPress Setup (Description about Themes & Plugins Added)
Complete WordPress Setup (Description about Themes & Plugins Added)Complete WordPress Setup (Description about Themes & Plugins Added)
Complete WordPress Setup (Description about Themes & Plugins Added)Ciceer Ghimirey
 
WordPress Introduction and WordPress Theme Installation Slides
WordPress Introduction and WordPress Theme Installation SlidesWordPress Introduction and WordPress Theme Installation Slides
WordPress Introduction and WordPress Theme Installation SlidesCiceer Ghimirey
 

More from Ciceer Ghimirey (8)

Machine Vision Concepts ,Application & Components.pptx
Machine Vision Concepts ,Application & Components.pptxMachine Vision Concepts ,Application & Components.pptx
Machine Vision Concepts ,Application & Components.pptx
 
Lab 5 Linux File Structure and Hierarchy.pptx
Lab 5 Linux File Structure and Hierarchy.pptxLab 5 Linux File Structure and Hierarchy.pptx
Lab 5 Linux File Structure and Hierarchy.pptx
 
Lab 4 -Linux Files, Directories and Basic Commands Part-2.pptx
Lab 4 -Linux Files, Directories and Basic Commands Part-2.pptxLab 4 -Linux Files, Directories and Basic Commands Part-2.pptx
Lab 4 -Linux Files, Directories and Basic Commands Part-2.pptx
 
Lab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptxLab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptx
 
Install Linux OS in Virtual Box.pptx
Install Linux OS in Virtual Box.pptxInstall Linux OS in Virtual Box.pptx
Install Linux OS in Virtual Box.pptx
 
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptx
 Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptx
 
Complete WordPress Setup (Description about Themes & Plugins Added)
Complete WordPress Setup (Description about Themes & Plugins Added)Complete WordPress Setup (Description about Themes & Plugins Added)
Complete WordPress Setup (Description about Themes & Plugins Added)
 
WordPress Introduction and WordPress Theme Installation Slides
WordPress Introduction and WordPress Theme Installation SlidesWordPress Introduction and WordPress Theme Installation Slides
WordPress Introduction and WordPress Theme Installation Slides
 

Recently uploaded

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Classification-Support Vector Machines.pptx

  • 3. Introduction: ● Support Vector Machine is a supervised machine learning problem where to try to find a hyperplane that best separates two classes. ● It is considered as one of the best algorithm as it can handle high-dimensional data, is effective in cases with limited training samples, and can handle nonlinear classification using kernel functions. ● SVM can be used for both regression and classification tasks, but generally work best in classification problem. What is SVM ?
  • 4. Types of SVM Algorithm: 1. Simple or Linear SVM: When the data is perfectly linearly separable only then we can use Linear SVM. Perfectly linearly separable means that the data points can be classified into 2 classes by using a single straight line(if 2D). 1. Kernel or Non-Linear SVM: When the data is not linearly separable then we can use Non-Linear SVM, which means when the data points cannot be separated into 2 classes by using a straight line (if 2D) then we use some advanced techniques like kernel tricks to classify them. In most real-world applications we do not find linearly separable data points hence we use kernel trick to solve them.
  • 5. Important Terms: 1. Support Vectors: These are the points that are closest to the hyperplane. A separating line will be defined with the help of these data points. 1. Margin: it is the distance between the hyperplane and the observations closest to the hyperplane (support vectors). There are two types of margins hard margin and soft margin. 1. Hyperplane: The best-line or decision boundary that can segregate N-dimensional space into classes so that we can easily put the new data point in the correct category.
  • 6. Hyper Plane: Hyperplanes are decision boundaries that help classify the data points. Data points falling on either side of the hyperplane can be attributed to different classes. dimension of the hyperplane = the number of features If, number of input features is 2, hyperplane is just a line. number of input features is 3, hyperplane becomes a two-dimensional plane.
  • 7. Objective: Objective of the SVM algorithm is to find a hyperplane that, to the best degree possible, separates data points of one class from those of another class.
  • 8. How does SVM work ? Suppose we have a dataset that has two classes (green and blue). We want to classify that the new data point as either blue or green.
  • 9. How does SVM work ? Best Hyperplane = Finding different hyperplanes which classify the labels in the best way then it will choose the one which is farthest from the data points or the one which has a maximum margin.
  • 10. Hard Margin SVM (Dot Product): ● Consider a random point X and we want to know whether it lies on the right side of the plane or the left side of the plane (positive or negative). ● First we assume this point is a vector (X) and then we make a vector (w) which is perpendicular to the hyperplane.
  • 11. Decision Rule: We all know the equation of a hyperplane is w.x+b=0 where w is a vector normal to hyperplane and b is an offset.
  • 12. Soft margin SVM: ● In real-life applications, we rarely encounter datasets that are perfectly linearly separable. Instead, we often come across datasets that are either nearly linearly separable or entirely non-linearly separable. ● To tackle this problem what we do is modify that equation in such a way that it allows few misclassifications that means it allows few points to be wrongly classified.
  • 13. Kernel in SVM: ● Kernels = functions that helps to convert lower dimension space to a higher dimension space using some quadratic functions.
  • 14. Types of Kernel Functions: ● Polynomial Kernel = Separate data of Degree 2. ● RBF Kernel = (Most used) Lift our samples onto a higher-dimensional feature ● Bessel function Kernel: Used for eliminating the cross term in mathematical functions ● Anova Kernel: Multidimensional regression problems Right Kernel = What type of Dataset we are working on? Linear Dataset = Linear Kernel Function Complex Dataset = RBF Kernel Function
  • 16. Load Data from CSV file
  • 18. Identification of the unwanted rows
  • 20. Divide data as Train/Test
  • 24. ● Accuracy: The portion of correctly classified instances among the total instances. ● Precision and recall: Precision measures the portion of true positive predictions among all positive predictions while recall measures the portion of true positive predictions among all actual positives. ● F1 Score: The harmonic mean of precision and recall, which provides a balance between the two metrics. ● Support: Support refers to the number of occurrences of each class in the actual data. It represents the number of samples belonging to each class. Metrics:
  • 25. ● SVM works better when the data is linear ● It is more effective in high dimensions ● With the help of the kernel trick, we can solve any complex problem ● SVM is not sensitive to outliers ● Can help us with Image Classification Advantages of SVM
  • 26. ● Choosing a good kernel is not easy ● It does not show good result on a big dataset ● The SVM hyperparameters are Cost -C and gamma. ● It is not easy to fine-tune these hyper-parameters. ● It is hard to visualize their impact Disadvantage of SVM
  • 27. ● We have demonstrated SVM by segregation two different classes. ● We discussed its concept of working, math intuition behind SVM, implementation in python, the tricks to classify non-linear datasets, Pros and cons, and finally, we solved a problem with the help of SVM. Support vector machine is an elegant and powerful algorithm. Conclusion: