SlideShare a Scribd company logo
3
CLASSIFICATION MODEL
• Following are the Machine Learning Classification models:
1. Logistic Regression
2. K-Nearest Neighbors (K-NN)
3. Support Vector Machine
4. Kernel SVM
5. Naïve Bayes
6. Decision Tree Classification
7. Random Forest Classification
4. Classification.pdf
1. Logistic Regression
1. Logistic Regression
1. Logistic Regression
1. Logistic Regression
1. Logistic Regression
1. Logistic Regression
1. Logistic Regression
1. Logistic Regression
1. Logistic Regression
Logistic Regression IMP Code
from sklearn.linear_model import LogisticRegression
classifier = LogisticRegression(random_state = 0)
classifier.fit(X_train, y_train)
1. Logistic Regression
# Visualising the Training set results
from matplotlib.colors import ListedColormap
X_set, y_set = X_train, y_train
X1, X2 = np.meshgrid(np.arange(start = X_set[:, 0].min() - 1, stop = X_set[:, 0].max() + 1, step = 0.01),
np.arange(start = X_set[:, 1].min() - 1, stop = X_set[:, 1].max() + 1, step = 0.01))
plt.contourf(X1, X2, classifier.predict(np.array([X1.ravel(), X2.ravel()]).T).reshape(X1.shape),
alpha = 0.75, cmap = ListedColormap(('red', 'green')))
plt.xlim(X1.min(), X1.max())
plt.ylim(X2.min(), X2.max())
for i, j in enumerate(np.unique(y_set)):
plt.scatter(X_set[y_set == j, 0], X_set[y_set == j, 1],
c = ListedColormap(('red', 'green'))(i), label = j)
plt.title('Logistic Regression (Training set)')
plt.xlabel('Age')
plt.ylabel('Estimated Salary')
plt.legend()
plt.show()
2. K-Nearest Neighbor (KNN)
KNN Algorithm
4. Classification.pdf
Euclidean Distance
4. Classification.pdf
4. Classification.pdf
4. Classification.pdf
4. Classification.pdf
KNN IMP Code
from sklearn.neighbors import KNeighborsClassifier
classifier = KNeighborsClassifier(n_neighbors = 5, metric = 'minkowski', p = 2)
classifier.fit(X_train, y_train)
Support Vector Machine (SVM)
3. Support Vector Machine (SVM)
3. Support Vector Machine (SVM)
3. Support Vector Machine (SVM)
What is so special about SVM?
What is so special about SVM?
What is so special about SVM?
SVM IMP Code & Confusion Matrix
from sklearn.svm import SVC
classifier = SVC(kernel = 'linear', random_state = 0)
classifier.fit(X_train, y_train)
array([[66, 2],
[ 8, 24]], dtype=int64)
Output of SVM
4. Kernel SVM
4. Kernel SVM
4. Classification.pdf
Mapping to Higher Dimension
Mapping to Higher Dimension
Mapping to Higher Dimension
Mapping to Higher Dimension
Mapping to Higher Dimension
SVM Kernel Functions
What is the Kernel Trick?
The Kernel trick is a very interesting and powerful tool.
It is powerful because it provides a bridge from linearity to non-linearity to any
algorithm that can be expressed solely on terms of dot products between two
vectors. It comes from the fact that, if we first map our input data into a higher-
dimensional space, a linear algorithm operating in this space will behave non-
linearly in the original input space. And, we do not exactly need the exact data
points, but only their inner products to compute our decision boundary.
What it implies is that if we want to transform our existing data into a higher
dimensional data, which in many cases help us classify better, we need not
compute the exact transformation of our data, we just need the inner product of
our data in that higher dimensional space.
What is the Kernel Trick?
What is the Kernel Trick?
Mapping from 1D to 2D
Regularization
The Gaussian RBF Kernel
The Gaussian RBF Kernel
The Gaussian RBF Kernel
The Gaussian RBF Kernel
The Gaussian RBF Kernel
The Gaussian RBF Kernel
Types of Kernel Functions
Types of Kernel Functions in 3D
IMP Code for Kernel SVM
from sklearn.svm import SVC
classifier = SVC(kernel = 'rbf', random_state = 0)
classifier.fit(X_train, y_train)
array([[64, 4],
[ 3, 29]], dtype=int64)
93 correctly classified and 7 incorrectly classified.
Projection from 3D to 2D using Kernel SVM
Projection from 3D to 2D using Kernel SVM
Output of Kernel SVM
4. Naïve Bayes Classification
Find the Defective Spanner
Bayes Theorem
Bayes Theorem
Bayes Theorem
Bayes Theorem
Bayes Theorem is Intuitive
Bayes Theorem is Intuitive
Naïve Bayes Theorem
Naïve Bayes Theorem
Naïve Bayes Theorem
Naïve Bayes Theorem
Naïve Bayes Theorem
Naïve Bayes Theorem
4. Classification.pdf
Naïve Bayes Theorem
Naïve Bayes Theorem
Naïve Bayes Theorem
Naïve Bayes Theorem
IMP code for Naïve Bayes
from sklearn.naive_bayes import GaussianNB
classifier = GaussianNB()
classifier.fit(X_train, y_train)
Confusion Matrix
array([[65, 3],
[ 7, 25]], dtype=int64)
IMP code for Naïve Bayes
5. Decision Tree Classification
IMP code for DTC
from sklearn.tree import DecisionTreeClassifier
classifier = DecisionTreeClassifier(criterion = 'entropy', random_state = 0)
classifier.fit(X_train, y_train)
• Confusion Matrix
array([[62, 6],
[ 3, 29]], dtype=int64)
91 correctly classified and 9 incorrectly classified
Output of DTC
6. Random Forest Classification : Based on Ensemble Learning
IMP Code for Random Forest Classification
from sklearn.ensemble import RandomForestClassifier
classifier = RandomForestClassifier(n_estimators = 10, criterion = 'entropy', random_state = 0)
classifier.fit(X_train, y_train)
Confusion Matrix
array([[63, 5],
[ 4, 28]], dtype=int64)
91 correctly classified and 9 incorrectly classified
Out of RFC
Classification Model Pros and Cons
Evaluating Classification
Models Performance
1. False Positives and False Negatives
2. Confusion Matrix
3. Accuracy Paradox
4. CAP Curve and its Analysis
1. False Positives & False Negatives
False Positives & False Negatives
There are two errors that often rear their head when you are learning about
hypothesis testing — false positives and false negatives, technically referred to
as type I error and type II error respectively.
A false positive (type I error) — when you reject a true null hypothesis
A false negative (type II error) — when you accept a false null hypothesis?
A False Positive Rate is an accuracy metric that can be measured on a
subset of machine learning models.
False Positives & False Negatives
False Positives & False Negatives
In binary prediction/classification terminology, there are four conditions
for any given outcome:
•True Positive: is the correct identification of anomalous data as such,
e.g., classifying as “abnormal” data which is in fact abnormal.
•True Negative: is the correct identification of data as not being
anomalous, i.e. classifying as “normal” data which is in fact normal.
•False Positive: is the incorrect identification of anomalous data as such,
i.e. classifying as “abnormal” data which is in fact normal.
•False Negative: is the incorrect identification of data as not being
anomalous, i.e. classifying as “normal” data which is in fact abnormal.
False Positives & False Negatives
False Positives & False Negatives
• A true positive is an outcome where the model correctly predicts the positive class. Similarly,
a true negative is an outcome where the model correctly predicts the negative class.
• A false positive is an outcome where the model incorrectly predicts the positive class. And a false
negative is an outcome where the model incorrectly predicts the negative class.
False Positives & False Negatives
False Positives & False Negatives
False Positives & False Negatives
False Positives & False Negatives
False Positives & False Negatives
False Positives & False Negatives
False Positives & False Negatives
A false positive is an
outcome where the
model incorrectly
predicts
the positive class.
A false negative is
an outcome where
the model incorrectly
predicts
the negative class.
2. Confusion Matrix
Confusion Matrix
Confusion Matrix
3. Accuracy Paradox
Accuracy Paradox
Accuracy Paradox
Cumulative Accuracy Profile (CAP)
Cumulative Accuracy Profile (CAP)
Cumulative Accuracy Profile (CAP)
Cumulative Accuracy Profile (CAP)
Cumulative Accuracy Profile (CAP)
Cumulative Accuracy Profile (CAP)
Cumulative Accuracy Profile (CAP)
Cumulative Accuracy Profile (CAP)
Cumulative Accuracy Profile (CAP)
CAP Curve
CAP Curve
Cumulative Accuracy Profile (CAP)
Cumulative Accuracy Profile (CAP)
4. Classification.pdf

More Related Content

PDF
3. Regression.pdf
Jyoti Yadav
 
PDF
1. Demystifying ML.pdf
Jyoti Yadav
 
PDF
5. Types of Clustering Algorithms in ML.pdf
Jyoti Yadav
 
PDF
6. Association Rule.pdf
Jyoti Yadav
 
PDF
8. Deep Learning.pdf
Jyoti Yadav
 
PDF
2. Data Preprocessing.pdf
Jyoti Yadav
 
PDF
7. Reinforcement Learning.pdf
Jyoti Yadav
 
PPTX
Meta-Learning Presentation
AkshayaNagarajan10
 
3. Regression.pdf
Jyoti Yadav
 
1. Demystifying ML.pdf
Jyoti Yadav
 
5. Types of Clustering Algorithms in ML.pdf
Jyoti Yadav
 
6. Association Rule.pdf
Jyoti Yadav
 
8. Deep Learning.pdf
Jyoti Yadav
 
2. Data Preprocessing.pdf
Jyoti Yadav
 
7. Reinforcement Learning.pdf
Jyoti Yadav
 
Meta-Learning Presentation
AkshayaNagarajan10
 

What's hot (20)

PPTX
Interpretable machine learning
Sri Ambati
 
PDF
DeepLearning 5章
hirono kawashima
 
PPTX
Support vector machine-SVM's
Anudeep Chowdary Kamepalli
 
PPTX
Intro to deep learning
David Voyles
 
PPTX
hands on machine learning Chapter 6&7 decision tree, ensemble and random forest
Jaey Jeong
 
PPTX
Supervised Machine Learning in R
Babu Priyavrat
 
PPTX
Supervised and Unsupervised Learning In Machine Learning | Machine Learning T...
Simplilearn
 
PDF
Automatic Machine Learning, AutoML
Himadri Mishra
 
PDF
PPT4: Frameworks & Libraries of Machine Learning & Deep Learning
akira-ai
 
PPTX
Underfitting and Overfitting in Machine Learning
Abdullah al Mamun
 
PDF
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Minh Pham
 
PDF
Support Vector Machines for Classification
Prakash Pimpale
 
PPTX
Build restful ap is with python and flask
Jeetendra singh
 
PPTX
Support Vector Machines- SVM
Carlo Carandang
 
PPTX
cnn ppt.pptx
rohithprabhas1
 
PDF
Scikit Learn Tutorial | Machine Learning with Python | Python for Data Scienc...
Edureka!
 
PDF
Introduction to Recurrent Neural Network
Knoldus Inc.
 
PPTX
Optimization/Gradient Descent
kandelin
 
PDF
Classification
CloudxLab
 
PPTX
Activation functions
PRATEEK SAHU
 
Interpretable machine learning
Sri Ambati
 
DeepLearning 5章
hirono kawashima
 
Support vector machine-SVM's
Anudeep Chowdary Kamepalli
 
Intro to deep learning
David Voyles
 
hands on machine learning Chapter 6&7 decision tree, ensemble and random forest
Jaey Jeong
 
Supervised Machine Learning in R
Babu Priyavrat
 
Supervised and Unsupervised Learning In Machine Learning | Machine Learning T...
Simplilearn
 
Automatic Machine Learning, AutoML
Himadri Mishra
 
PPT4: Frameworks & Libraries of Machine Learning & Deep Learning
akira-ai
 
Underfitting and Overfitting in Machine Learning
Abdullah al Mamun
 
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Minh Pham
 
Support Vector Machines for Classification
Prakash Pimpale
 
Build restful ap is with python and flask
Jeetendra singh
 
Support Vector Machines- SVM
Carlo Carandang
 
cnn ppt.pptx
rohithprabhas1
 
Scikit Learn Tutorial | Machine Learning with Python | Python for Data Scienc...
Edureka!
 
Introduction to Recurrent Neural Network
Knoldus Inc.
 
Optimization/Gradient Descent
kandelin
 
Classification
CloudxLab
 
Activation functions
PRATEEK SAHU
 
Ad

Similar to 4. Classification.pdf (20)

PPT
Supervised and unsupervised learning
AmAn Singh
 
PDF
Robustness Metrics for ML Models based on Deep Learning Methods
Data Science Milan
 
PDF
Barga Data Science lecture 7
Roger Barga
 
PDF
Support Vector Machines ( SVM )
Mohammad Junaid Khan
 
PDF
Machine Learning : why we should know and how it works
Kevin Lee
 
PPTX
svm.pptx
PriyadharshiniG41
 
PPT
lec10svm.ppt
pushkarjoshi42
 
PPT
lec10svm.ppt
kibrualemu812
 
PPT
Support Vector Machines (lecture by Geoffrey Hinton)
ssuser0f60fc2
 
PPT
lec10svm.ppt SVM lecture machine learning
AmgadAbdallah2
 
PPT
Svm ms
student
 
PPT
SVM_UNI_TORON_SPACE_VECTOR_MACHINE_MACHINE_LEARNING.ppt
Candy491
 
PPT
SUPPORT _ VECTOR _ MACHINE _ PRESENTATION
priinku0410
 
PPTX
sentiment analysis using support vector machine
Shital Andhale
 
PDF
Workshop - Introduction to Machine Learning with R
Shirin Elsinghorst
 
PPT
lec10svm.ppt
TheULTIMATEALLROUNDE
 
PPTX
Predict Backorder on a supply chain data for an Organization
Piyush Srivastava
 
PDF
Machine Learning with Python- Machine Learning Algorithms.pdf
KalighatOkira
 
PPTX
Anomaly Detection and Localization Using GAN and One-Class Classifier
홍배 김
 
PPTX
Escaping the Black Box
Rebecca Bilbro
 
Supervised and unsupervised learning
AmAn Singh
 
Robustness Metrics for ML Models based on Deep Learning Methods
Data Science Milan
 
Barga Data Science lecture 7
Roger Barga
 
Support Vector Machines ( SVM )
Mohammad Junaid Khan
 
Machine Learning : why we should know and how it works
Kevin Lee
 
lec10svm.ppt
pushkarjoshi42
 
lec10svm.ppt
kibrualemu812
 
Support Vector Machines (lecture by Geoffrey Hinton)
ssuser0f60fc2
 
lec10svm.ppt SVM lecture machine learning
AmgadAbdallah2
 
Svm ms
student
 
SVM_UNI_TORON_SPACE_VECTOR_MACHINE_MACHINE_LEARNING.ppt
Candy491
 
SUPPORT _ VECTOR _ MACHINE _ PRESENTATION
priinku0410
 
sentiment analysis using support vector machine
Shital Andhale
 
Workshop - Introduction to Machine Learning with R
Shirin Elsinghorst
 
lec10svm.ppt
TheULTIMATEALLROUNDE
 
Predict Backorder on a supply chain data for an Organization
Piyush Srivastava
 
Machine Learning with Python- Machine Learning Algorithms.pdf
KalighatOkira
 
Anomaly Detection and Localization Using GAN and One-Class Classifier
홍배 김
 
Escaping the Black Box
Rebecca Bilbro
 
Ad

More from Jyoti Yadav (12)

PDF
Part 4: Understanding the working of Smart Contracts
Jyoti Yadav
 
PDF
Part 3 Introduction to Cryptocurrency.pdf
Jyoti Yadav
 
PDF
Part 2 Blockchain Programming Using Python.pdf
Jyoti Yadav
 
PDF
Part 1: Introduction to Blockchain Fundamentals
Jyoti Yadav
 
PDF
Natural Language Processing Algorithm...
Jyoti Yadav
 
PDF
6. Web Publishing
Jyoti Yadav
 
PDF
5. Web Technology CSS Advanced
Jyoti Yadav
 
PDF
4. Web Technology CSS Basics-1
Jyoti Yadav
 
PDF
3. Web Technology Advanced HTML
Jyoti Yadav
 
PDF
2b. Web Technology HTML Basics-2
Jyoti Yadav
 
PDF
2a web technology html basics 1
Jyoti Yadav
 
PDF
1. web technology basics
Jyoti Yadav
 
Part 4: Understanding the working of Smart Contracts
Jyoti Yadav
 
Part 3 Introduction to Cryptocurrency.pdf
Jyoti Yadav
 
Part 2 Blockchain Programming Using Python.pdf
Jyoti Yadav
 
Part 1: Introduction to Blockchain Fundamentals
Jyoti Yadav
 
Natural Language Processing Algorithm...
Jyoti Yadav
 
6. Web Publishing
Jyoti Yadav
 
5. Web Technology CSS Advanced
Jyoti Yadav
 
4. Web Technology CSS Basics-1
Jyoti Yadav
 
3. Web Technology Advanced HTML
Jyoti Yadav
 
2b. Web Technology HTML Basics-2
Jyoti Yadav
 
2a web technology html basics 1
Jyoti Yadav
 
1. web technology basics
Jyoti Yadav
 

Recently uploaded (20)

PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Doc9.....................................
SofiaCollazos
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Software Development Methodologies in 2025
KodekX
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 

4. Classification.pdf